Split entity_items and appears query into more granular queries

We can be a bit more specific about the information we get this way
This commit is contained in:
mitteneer 2025-06-06 14:28:15 -04:00
parent adcaff34ea
commit 3ef17fcd46
4 changed files with 69 additions and 32 deletions

View file

@ -20,7 +20,7 @@ pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
const album = try queries.entityQueryResult(request, queries.loadQuery(.album, .entity_info), .{id});
try root.put("album", album);
const songs = try queries.entityQueryResult(request, queries.loadQuery(.album, .entity_items), .{id});
const songs = try queries.entityQueryResult(request, queries.loadQuery(.album, .get_songs), .{id});
try root.put("songs", songs);
const firstlast = try queries.entityQueryResult(request, queries.loadQuery(.album, .firstlast), .{id});

View file

@ -21,7 +21,7 @@ pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
const artist = try queries.entityQueryResult(request, queries.loadQuery(.artist, .entity_info), .{id});
try root.put("artist", artist);
const albums = try queries.entityQueryResult(request, queries.loadQuery(.artist, .entity_items), .{id});
const albums = try queries.entityQueryResult(request, queries.loadQuery(.artist, .get_albums), .{id});
try root.put("albums", albums);
const appears = try queries.entityQueryResult(request, queries.loadQuery(.artist, .appears), .{id});

View file

@ -17,11 +17,11 @@ pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View {
const song = try queries.entityQueryResult(request, queries.loadQuery(.song, .entity_info), .{id});
try root.put("song", song);
const scrobbles = try queries.entityQueryResult(request, queries.loadQuery(.song, .entity_items), .{id});
const scrobbles = try queries.entityQueryResult(request, queries.loadQuery(.song, .get_scrobbles), .{id});
try root.put("scrobbles", scrobbles);
const appears = try queries.entityQueryResult(request, queries.loadQuery(.song, .appears), .{id});
try root.put("appears", appears);
const albums = try queries.entityQueryResult(request, queries.loadQuery(.song, .get_albums), .{id});
try root.put("albums", albums);
const firstlast = try queries.entityQueryResult(request, queries.loadQuery(.song, .firstlast), .{id});
try root.put("firstlast", firstlast);