Fix date parsing

For some reason, I had date in "raw_scrobbles" set as an i32.
Pretty annoying considering I'm probably going to remove the
raw_scrobbles step at some point anyways.
This commit is contained in:
mitteneer 2024-12-16 11:59:11 -05:00
parent c541893572
commit a3b3a6c008
4 changed files with 6 additions and 6 deletions

View file

@ -182,7 +182,7 @@ pub const RawScrobble = jetquery.Model(
track: []const u8,
artist: []const u8,
album: []const u8,
date: i32,
date: jetquery.DateTime,
created_at: jetquery.DateTime,
updated_at: jetquery.DateTime,
},

View file

@ -10,7 +10,7 @@ pub fn up(repo: anytype) !void {
t.column("track", .string, .{}),
t.column("artist", .string, .{}),
t.column("album", .string, .{}),
t.column("date", .integer, .{}),
t.column("date", .datetime, .{}),
t.timestamps(.{}),
},
.{},

View file

@ -18,7 +18,7 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
track: []u8,
artist: []u8,
album: []u8,
date: i64,
date: u64,
};
const lastfm = struct {
@ -43,7 +43,7 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
//std.debug.print("{d}\n", .{song_hash});
const database_update = jetzig.database.Query(.RawScrobble)
.insert(.{ .id = counter, .track = scrobble.track, .album = scrobble.album, .artist = scrobble.artist, .date = @divFloor(scrobble.date, 1000) });
.insert(.{ .id = counter, .track = scrobble.track, .album = scrobble.album, .artist = scrobble.artist, .date = (scrobble.date * 1000) });
try request.repo.execute(database_update);
counter += 1;