diff --git a/src/app/views/albums.zig b/src/app/views/albums.zig index 07cf4a1..790be2d 100644 --- a/src/app/views/albums.zig +++ b/src/app/views/albums.zig @@ -16,8 +16,9 @@ pub fn index(request: *jetzig.Request) !jetzig.View { } pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View { + const album = try jetzig.database.Query(.Album).find(id).execute(request.repo); var root = try request.data(.object); - try root.put("album_id", id); + try root.put("album", album.?.name); var songs_view = try root.put("songs", .array); const query = jetzig.database.Query(.Albumsong).include(.song, .{ .select = .{ .name, .id } }).join(.inner, .album).where(.{ .album = .{ .id = id } }); const songs = try request.repo.all(query); diff --git a/src/app/views/albums/get.zmpl b/src/app/views/albums/get.zmpl index ac3760d..6459fb6 100644 --- a/src/app/views/albums/get.zmpl +++ b/src/app/views/albums/get.zmpl @@ -5,7 +5,7 @@ @partial partials/header -

no one lol

+

{{.album}}

diff --git a/src/app/views/artists.zig b/src/app/views/artists.zig index 9f2038f..a1e464a 100644 --- a/src/app/views/artists.zig +++ b/src/app/views/artists.zig @@ -19,11 +19,9 @@ pub fn index(request: *jetzig.Request) !jetzig.View { } pub fn get(id: []const u8, request: *jetzig.Request) !jetzig.View { - //const artist_name = jetzig.database.Query(.Artist).find().select(.{.name}).execute(request.repo); - std.log.debug("page: {s}", .{id}); + const artist = try jetzig.database.Query(.Artist).find(id).execute(request.repo); var root = try request.data(.object); - //try root.put("artist", artist_name); - try root.put("artist_id", id); + try root.put("artist", artist.?.name); var albums_view = try root.put("albums", .array); const query = jetzig.database.Query(.Albumartist).include(.album, .{ .select = .{ .name, .id } }).join(.inner, .artist).where(.{ .artist = .{ .id = id } }); const albums = try request.repo.all(query); diff --git a/src/app/views/artists/get.zmpl b/src/app/views/artists/get.zmpl index d1e4904..c81d57d 100644 --- a/src/app/views/artists/get.zmpl +++ b/src/app/views/artists/get.zmpl @@ -5,7 +5,7 @@ @partial partials/header -

no one lol

+

{{.artist}}

Name
Name