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

@ -16,8 +16,8 @@
// internet connectivity.
.dependencies = .{
.jetzig = .{
.url = "https://github.com/jetzig-framework/jetzig/archive/7b038505930e8075fc5507c1e396fc073f6a46bb.tar.gz",
.hash = "122029af480bfe9fdcbfb6be77ff0bef0c20dba803dceaf48c09de2a99ab375d11c8",
.url = "https://github.com/jetzig-framework/jetzig/archive/475ed269525624a67004594ddca44dc8ebea1919.tar.gz",
.hash = "1220bc060ba2320fa9fed8e554a8b692a93ef73fa3ab40617b9ed1d928d2029297fb",
},
},
.paths = .{

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;