Switch dates from u64 to i64

PostgreSQL only uses signed ints, so this makes things much easier
This commit is contained in:
mitteneer 2025-04-28 23:01:34 -04:00
parent cb89a3e6f3
commit ae85f94ddb
3 changed files with 4 additions and 4 deletions

View file

@ -33,7 +33,7 @@ pub fn run(allocator: std.mem.Allocator, params: *jetzig.data.Value, env: jetzig
.artists_track = track_artist_name_buffer,
.album = item.getT(.string, "album") orelse "",
.artists_album = album_artist_name_buffer,
.date = @as(u64, @bitCast(@as(i64, @truncate(item.getT(.integer, "date").?)))),
.date = @as(i64, @truncate(item.getT(.integer, "date").?)),
};
var id_prehash = std.ArrayList(u8).init(allocator);

View file

@ -111,7 +111,7 @@ pub fn post(request: *jetzig.Request) !jetzig.View {
.track = scrobble.master_metadata_track_name.?,
.album = scrobble.master_metadata_album_album_name.?,
.artist = scrobble.master_metadata_album_artist_name.?,
.date = @as(u64, @bitCast((try zeit.instant(.{ .source = .{ .iso8601 = scrobble.ts } })).unixTimestamp() * 1000)),
.date = (try zeit.instant(.{ .source = .{ .iso8601 = scrobble.ts } })).unixTimestamp() * 1000,
};
const formatted_scrobble = if (rule_list) |rl|