From 295d1b98cb365339cd62fd96189a79c804b4e07f Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Tue, 10 Nov 2026 15:23:11 +0100 Subject: [PATCH 1/9] feat: #23 expose MusicBrainz release group IDs --- client/src/App.test.tsx | 1 + client/src/a11y.test.tsx | 1 + client/src/api/albumDetail.ts | 1 + client/src/api/client.test.ts | 1 + client/src/api/crate.ts | 1 + client/src/api/searchAlbums.ts | 1 + client/src/components/AlbumCard.test.tsx | 2 + client/src/generated/gql.ts | 18 ++++----- client/src/generated/graphql.ts | 12 +++--- client/src/pages/AlbumDetailPage.test.tsx | 1 + client/src/pages/CratePage.test.tsx | 1 + client/src/pagination.test.tsx | 1 + schema.graphql | 1 + server/src/crate.postgres.test.ts | 49 ++++++++++++++++++++++- server/src/resolvers.ts | 11 ++++- 15 files changed, 84 insertions(+), 18 deletions(-) diff --git a/client/src/App.test.tsx b/client/src/App.test.tsx index 2375df5..dce7943 100644 --- a/client/src/App.test.tsx +++ b/client/src/App.test.tsx @@ -18,6 +18,7 @@ const album: AlbumSummary = { title: 'Abbey Road', artists: [{ id: '1', name: 'The Beatles' }], releaseYear: 1969, + musicBrainzReleaseGroupId: null, genres: [{ id: '1', name: 'Rock' }], averageRating: 4.8, reviewCount: 1240, diff --git a/client/src/a11y.test.tsx b/client/src/a11y.test.tsx index 15bff44..f9263cc 100644 --- a/client/src/a11y.test.tsx +++ b/client/src/a11y.test.tsx @@ -19,6 +19,7 @@ const album: AlbumSummary = { title: 'Abbey Road', artists: [{ id: '1', name: 'The Beatles' }], releaseYear: 1969, + musicBrainzReleaseGroupId: null, genres: [{ id: '1', name: 'Rock' }], averageRating: 4.8, reviewCount: 1240, diff --git a/client/src/api/albumDetail.ts b/client/src/api/albumDetail.ts index 8aa6308..415d064 100644 --- a/client/src/api/albumDetail.ts +++ b/client/src/api/albumDetail.ts @@ -13,6 +13,7 @@ export const ALBUM_DETAIL = graphql(` id title releaseYear + musicBrainzReleaseGroupId artists { id name diff --git a/client/src/api/client.test.ts b/client/src/api/client.test.ts index 7353d02..cdb07ef 100644 --- a/client/src/api/client.test.ts +++ b/client/src/api/client.test.ts @@ -26,6 +26,7 @@ function result(ids: string[], endCursor: string, hasNextPage = true): SearchAlb artists: [], genres: [], releaseYear: null, + musicBrainzReleaseGroupId: null, averageRating: null, reviewCount: 0, isInCrate: false, diff --git a/client/src/api/crate.ts b/client/src/api/crate.ts index 60656e8..e82a965 100644 --- a/client/src/api/crate.ts +++ b/client/src/api/crate.ts @@ -53,6 +53,7 @@ export const MY_CRATE = graphql(` id title releaseYear + musicBrainzReleaseGroupId averageRating reviewCount isInCrate diff --git a/client/src/api/searchAlbums.ts b/client/src/api/searchAlbums.ts index cb95e21..6afc210 100644 --- a/client/src/api/searchAlbums.ts +++ b/client/src/api/searchAlbums.ts @@ -42,6 +42,7 @@ export const SEARCH_ALBUMS = graphql(` id title releaseYear + musicBrainzReleaseGroupId artists { id name diff --git a/client/src/components/AlbumCard.test.tsx b/client/src/components/AlbumCard.test.tsx index b83fef2..ee3c8dc 100644 --- a/client/src/components/AlbumCard.test.tsx +++ b/client/src/components/AlbumCard.test.tsx @@ -12,6 +12,7 @@ const album: AlbumSummary = { artists: [], genres: [], releaseYear: null, + musicBrainzReleaseGroupId: null, averageRating: null, reviewCount: 0, isInCrate: false, @@ -28,6 +29,7 @@ it('handles nullable summary fields without inventing a rating or year', () => { artists: [{ id: '1', name: 'The Beatles' }], genres: [{ id: '1', name: 'Rock' }], releaseYear: null, + musicBrainzReleaseGroupId: null, averageRating: null, reviewCount: 0, isInCrate: false, diff --git a/client/src/generated/gql.ts b/client/src/generated/gql.ts index a38e7f0..ab038e2 100644 --- a/client/src/generated/gql.ts +++ b/client/src/generated/gql.ts @@ -14,22 +14,22 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size */ type Documents = { - "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": typeof types.AlbumDetailDocument, + "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": typeof types.AlbumDetailDocument, "\n mutation AddToCrate($albumId: ID!) {\n addToCrate(albumId: $albumId) {\n item {\n id\n }\n album {\n id\n isInCrate\n }\n }\n }\n": typeof types.AddToCrateDocument, "\n mutation RemoveFromCrate($albumId: ID!) {\n removeFromCrate(albumId: $albumId) {\n removedAlbumId\n album {\n id\n isInCrate\n }\n }\n }\n": typeof types.RemoveFromCrateDocument, - "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n": typeof types.MyCrateDocument, + "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n": typeof types.MyCrateDocument, "\n mutation UpsertReview($input: UpsertReviewInput!) {\n upsertReview(input: $input) {\n review {\n id\n rating\n comment\n }\n album {\n id\n }\n }\n }\n": typeof types.UpsertReviewDocument, "\n mutation DeleteReview($id: ID!) {\n deleteReview(id: $id) {\n deletedReviewId\n album {\n id\n }\n }\n }\n": typeof types.DeleteReviewDocument, - "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": typeof types.SearchAlbumsDocument, + "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": typeof types.SearchAlbumsDocument, }; const documents: Documents = { - "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": types.AlbumDetailDocument, + "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n": types.AlbumDetailDocument, "\n mutation AddToCrate($albumId: ID!) {\n addToCrate(albumId: $albumId) {\n item {\n id\n }\n album {\n id\n isInCrate\n }\n }\n }\n": types.AddToCrateDocument, "\n mutation RemoveFromCrate($albumId: ID!) {\n removeFromCrate(albumId: $albumId) {\n removedAlbumId\n album {\n id\n isInCrate\n }\n }\n }\n": types.RemoveFromCrateDocument, - "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n": types.MyCrateDocument, + "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n": types.MyCrateDocument, "\n mutation UpsertReview($input: UpsertReviewInput!) {\n upsertReview(input: $input) {\n review {\n id\n rating\n comment\n }\n album {\n id\n }\n }\n }\n": types.UpsertReviewDocument, "\n mutation DeleteReview($id: ID!) {\n deleteReview(id: $id) {\n deletedReviewId\n album {\n id\n }\n }\n }\n": types.DeleteReviewDocument, - "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": types.SearchAlbumsDocument, + "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n": types.SearchAlbumsDocument, }; /** @@ -49,7 +49,7 @@ export function graphql(source: string): unknown; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n"): (typeof documents)["\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n"]; +export function graphql(source: "\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n"): (typeof documents)["\n query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) {\n album(id: $id) {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n tracks {\n id\n title\n trackNumber\n durationSeconds\n }\n averageRating\n reviewCount\n isInCrate\n myReview {\n id\n rating\n comment\n }\n reviews(first: $reviewFirst, after: $reviewAfter) {\n edges {\n cursor\n node {\n id\n rating\n comment\n createdAt\n user {\n id\n displayName\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -61,7 +61,7 @@ export function graphql(source: "\n mutation RemoveFromCrate($albumId: ID!) {\n /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n"]; +export function graphql(source: "\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query MyCrate($first: Int!, $after: String) {\n myCrate(first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n addedAt\n album {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n averageRating\n reviewCount\n isInCrate\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -73,7 +73,7 @@ export function graphql(source: "\n mutation DeleteReview($id: ID!) {\n dele /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n"): (typeof documents)["\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n"]; +export function graphql(source: "\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n"): (typeof documents)["\n query SearchAlbums($input: AlbumSearchInput!, $first: Int!, $after: String) {\n searchAlbums(input: $input, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n title\n releaseYear\n musicBrainzReleaseGroupId\n artists {\n id\n name\n }\n genres {\n id\n name\n }\n averageRating\n reviewCount\n isInCrate\n }\n }\n totalCount\n genreFacets {\n genre {\n id\n name\n }\n count\n }\n decadeFacets {\n decade\n count\n }\n reviewedCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n"]; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/client/src/generated/graphql.ts b/client/src/generated/graphql.ts index 0dc165e..0447de3 100644 --- a/client/src/generated/graphql.ts +++ b/client/src/generated/graphql.ts @@ -34,7 +34,7 @@ export type AlbumDetailQueryVariables = Exact<{ }>; -export type AlbumDetailQuery = { album: { id: string, title: string, releaseYear: number | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }>, tracks: Array<{ id: string, title: string, trackNumber: number, durationSeconds: number | null }>, myReview: { id: string, rating: number, comment: string } | null, reviews: { totalCount: number, edges: Array<{ cursor: string, node: { id: string, rating: number, comment: string, createdAt: string, user: { id: string, displayName: string } } }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } } | null }; +export type AlbumDetailQuery = { album: { id: string, title: string, releaseYear: number | null, musicBrainzReleaseGroupId: string | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }>, tracks: Array<{ id: string, title: string, trackNumber: number, durationSeconds: number | null }>, myReview: { id: string, rating: number, comment: string } | null, reviews: { totalCount: number, edges: Array<{ cursor: string, node: { id: string, rating: number, comment: string, createdAt: string, user: { id: string, displayName: string } } }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } } | null }; export type AddToCrateMutationVariables = Exact<{ albumId: string | number; @@ -56,7 +56,7 @@ export type MyCrateQueryVariables = Exact<{ }>; -export type MyCrateQuery = { myCrate: { totalCount: number, edges: Array<{ cursor: string, node: { id: string, addedAt: string, album: { id: string, title: string, releaseYear: number | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }> } } }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } }; +export type MyCrateQuery = { myCrate: { totalCount: number, edges: Array<{ cursor: string, node: { id: string, addedAt: string, album: { id: string, title: string, releaseYear: number | null, musicBrainzReleaseGroupId: string | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }> } } }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } }; export type UpsertReviewMutationVariables = Exact<{ input: UpsertReviewInput; @@ -79,13 +79,13 @@ export type SearchAlbumsQueryVariables = Exact<{ }>; -export type SearchAlbumsQuery = { searchAlbums: { totalCount: number, reviewedCount: number, edges: Array<{ cursor: string, node: { id: string, title: string, releaseYear: number | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }> } }>, genreFacets: Array<{ count: number, genre: { id: string, name: string } }>, decadeFacets: Array<{ decade: number, count: number }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } }; +export type SearchAlbumsQuery = { searchAlbums: { totalCount: number, reviewedCount: number, edges: Array<{ cursor: string, node: { id: string, title: string, releaseYear: number | null, musicBrainzReleaseGroupId: string | null, averageRating: number | null, reviewCount: number, isInCrate: boolean, artists: Array<{ id: string, name: string }>, genres: Array<{ id: string, name: string }> } }>, genreFacets: Array<{ count: number, genre: { id: string, name: string } }>, decadeFacets: Array<{ decade: number, count: number }>, pageInfo: { hasNextPage: boolean, endCursor: string | null } } }; -export const AlbumDetailDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AlbumDetail"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"reviewFirst"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"reviewAfter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"album"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"tracks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"trackNumber"}},{"kind":"Field","name":{"kind":"Name","value":"durationSeconds"}}]}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}},{"kind":"Field","name":{"kind":"Name","value":"myReview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"rating"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"reviews"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"reviewFirst"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"reviewAfter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"rating"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const AlbumDetailDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AlbumDetail"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"reviewFirst"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"reviewAfter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"album"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"musicBrainzReleaseGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"tracks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"trackNumber"}},{"kind":"Field","name":{"kind":"Name","value":"durationSeconds"}}]}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}},{"kind":"Field","name":{"kind":"Name","value":"myReview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"rating"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"reviews"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"reviewFirst"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"reviewAfter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"rating"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const AddToCrateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddToCrate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"albumId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addToCrate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"albumId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"albumId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}}]}}]}}]}}]} as unknown as DocumentNode; export const RemoveFromCrateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveFromCrate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"albumId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeFromCrate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"albumId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"albumId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removedAlbumId"}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}}]}}]}}]}}]} as unknown as DocumentNode; -export const MyCrateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyCrate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myCrate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"addedAt"}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode; +export const MyCrateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyCrate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"myCrate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"addedAt"}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"musicBrainzReleaseGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode; export const UpsertReviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpsertReview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpsertReviewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"upsertReview"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"review"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"rating"}},{"kind":"Field","name":{"kind":"Name","value":"comment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode; export const DeleteReviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteReview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteReview"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletedReviewId"}},{"kind":"Field","name":{"kind":"Name","value":"album"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode; -export const SearchAlbumsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchAlbums"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AlbumSearchInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"searchAlbums"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"genreFacets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"genre"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"decadeFacets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"decade"}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"reviewedCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const SearchAlbumsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchAlbums"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AlbumSearchInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"searchAlbums"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"edges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"node"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"releaseYear"}},{"kind":"Field","name":{"kind":"Name","value":"musicBrainzReleaseGroupId"}},{"kind":"Field","name":{"kind":"Name","value":"artists"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"genres"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"averageRating"}},{"kind":"Field","name":{"kind":"Name","value":"reviewCount"}},{"kind":"Field","name":{"kind":"Name","value":"isInCrate"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"genreFacets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"genre"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"decadeFacets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"decade"}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"reviewedCount"}},{"kind":"Field","name":{"kind":"Name","value":"pageInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/client/src/pages/AlbumDetailPage.test.tsx b/client/src/pages/AlbumDetailPage.test.tsx index 2022376..8b9331a 100644 --- a/client/src/pages/AlbumDetailPage.test.tsx +++ b/client/src/pages/AlbumDetailPage.test.tsx @@ -13,6 +13,7 @@ const detail = { id: '1', title: 'Abbey Road', releaseYear: 1969, + musicBrainzReleaseGroupId: null, artists: [{ id: '1', name: 'The Beatles' }], genres: [{ id: '1', name: 'Rock' }], tracks: [ diff --git a/client/src/pages/CratePage.test.tsx b/client/src/pages/CratePage.test.tsx index 7f9cefa..6b4beb8 100644 --- a/client/src/pages/CratePage.test.tsx +++ b/client/src/pages/CratePage.test.tsx @@ -12,6 +12,7 @@ const album = { id: '1', title: 'Abbey Road', releaseYear: 1969, + musicBrainzReleaseGroupId: null, averageRating: 4.8, reviewCount: 1240, isInCrate: true, diff --git a/client/src/pagination.test.tsx b/client/src/pagination.test.tsx index 6e0c1c4..9f1edf6 100644 --- a/client/src/pagination.test.tsx +++ b/client/src/pagination.test.tsx @@ -53,6 +53,7 @@ function page( artists: [], genres: [], releaseYear: null, + musicBrainzReleaseGroupId: null, averageRating: null, reviewCount: 0, isInCrate: false, diff --git a/schema.graphql b/schema.graphql index 0edf8c4..08d3713 100644 --- a/schema.graphql +++ b/schema.graphql @@ -17,6 +17,7 @@ type Album { id: ID! title: String! releaseYear: Int + musicBrainzReleaseGroupId: String artists: [Artist!]! tracks: [Track!]! genres: [Genre!]! diff --git a/server/src/crate.postgres.test.ts b/server/src/crate.postgres.test.ts index c9255ca..30c0022 100644 --- a/server/src/crate.postgres.test.ts +++ b/server/src/crate.postgres.test.ts @@ -1,6 +1,9 @@ import { randomUUID } from 'node:crypto'; +import { readFileSync } from 'node:fs'; import { drizzle } from 'drizzle-orm/node-postgres'; import { eq, inArray, sql } from 'drizzle-orm'; +import { graphql } from 'graphql'; +import { createSchema } from 'graphql-yoga'; import pg from 'pg'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; @@ -21,6 +24,7 @@ describe.skipIf(!process.env.TEST_DATABASE_URL)('PostgreSQL myCrate', () => { const stranger = randomUUID(); const albumIds: number[] = []; const ownerItems: number[] = []; + const releaseGroupId = randomUUID(); function query(first: number, after?: string | null, userId: string | null = owner) { return resolvers.Query.myCrate( @@ -45,7 +49,11 @@ describe.skipIf(!process.env.TEST_DATABASE_URL)('PostgreSQL myCrate', () => { for (const index of [1, 2, 3, 4, 5]) { const [row] = await db .insert(album) - .values({ title: `Crate album ${index} ${word}`, releaseYear: 1990 + index }) + .values({ + title: `Crate album ${index} ${word}`, + releaseYear: 1990 + index, + musicBrainzReleaseGroupId: index === 1 ? releaseGroupId : null, + }) .returning(); albumIds.push(row!.id); } @@ -75,6 +83,45 @@ describe.skipIf(!process.env.TEST_DATABASE_URL)('PostgreSQL myCrate', () => { await pool.end(); }); + it.each([0, 1])( + 'returns the nullable release-group ID through search, details and My Crate (album %i)', + async (index) => { + const schema = createSchema({ + typeDefs: readFileSync(new URL('../../schema.graphql', import.meta.url), 'utf8'), + resolvers, + }); + const result = await graphql({ + schema, + source: ` + query AlbumIdentifiers($id: ID!, $input: AlbumSearchInput!) { + album(id: $id) { id musicBrainzReleaseGroupId } + searchAlbums(input: $input, first: 20) { + edges { node { id musicBrainzReleaseGroupId } } + } + myCrate(first: 20) { + edges { node { album { id musicBrainzReleaseGroupId } } } + } + } + `, + variableValues: { + id: String(albumIds[index]), + input: { query: word, sort: 'TITLE_ASC' }, + }, + contextValue: { db, userId: owner, loaders: createLoaders(db, owner) }, + }); + const expected = { + id: String(albumIds[index]), + musicBrainzReleaseGroupId: index === 0 ? releaseGroupId : null, + }; + expect(result.errors).toBeUndefined(); + expect(result.data).toMatchObject({ + album: expected, + searchAlbums: { edges: expect.arrayContaining([{ node: expected }]) }, + myCrate: { edges: expect.arrayContaining([{ node: { album: expected } }]) }, + }); + }, + ); + it('returns the newest items first, with a stable tie-break inside a second', async () => { const result = await query(20); diff --git a/server/src/resolvers.ts b/server/src/resolvers.ts index c41e6d8..b590b3a 100644 --- a/server/src/resolvers.ts +++ b/server/src/resolvers.ts @@ -20,7 +20,12 @@ import { addToCrate, removeFromCrate } from './crate.js'; export type Context = { db: Db; loaders: Loaders; userId: string | null }; -type AlbumRow = { id: number; title: string; releaseYear: number | null }; +type AlbumRow = { + id: number; + title: string; + releaseYear: number | null; + musicBrainzReleaseGroupId: string | null; +}; type SearchArgs = { input: AlbumSearchInput; first: number; after?: string | null }; type AlbumArgs = { id: string }; @@ -225,7 +230,9 @@ async function searchAlbums(db: Db, { input, first, after }: SearchArgs) { const [page, total, genreFacets, decadeFacets, reviewed] = await Promise.all([ // One extra row tells us whether there is a next page. db.execute(sql` - SELECT album.id, album.title, album.release_year AS "releaseYear", ${key.expr} AS "sortValue" + SELECT album.id, album.title, album.release_year AS "releaseYear", + album.musicbrainz_release_group_id AS "musicBrainzReleaseGroupId", + ${key.expr} AS "sortValue" FROM album WHERE ${filter} AND ${afterSql} ORDER BY ${orderBy(key)} From 5e683c55d3697ca6266e91750ef37fe9e4a3e088 Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Tue, 10 Nov 2026 17:13:49 +0100 Subject: [PATCH 2/9] feat: #23 display responsive album covers in cards --- client/src/components/AlbumCard.css | 29 ++++--------- client/src/components/AlbumCard.test.tsx | 24 ++++++++++- client/src/components/AlbumCard.tsx | 6 ++- client/src/components/AlbumCover.css | 39 +++++++++++++++++ client/src/components/AlbumCover.test.tsx | 52 +++++++++++++++++++++++ client/src/components/AlbumCover.tsx | 38 +++++++++++++++++ client/src/components/ResultsLayout.css | 1 + 7 files changed, 166 insertions(+), 23 deletions(-) create mode 100644 client/src/components/AlbumCover.css create mode 100644 client/src/components/AlbumCover.test.tsx create mode 100644 client/src/components/AlbumCover.tsx diff --git a/client/src/components/AlbumCard.css b/client/src/components/AlbumCard.css index 486e93b..3eba9a2 100644 --- a/client/src/components/AlbumCard.css +++ b/client/src/components/AlbumCard.css @@ -1,3 +1,5 @@ +@import './AlbumCover.css'; + .album-card { position: relative; isolation: isolate; @@ -17,27 +19,12 @@ display: grid; place-items: center; } -.album-card__record { - width: 68%; - aspect-ratio: 1; - border-radius: 50%; - border: 1px solid var(--border-strong); - background: repeating-radial-gradient( - circle, - var(--surface) 0 5px, - var(--border) 6px 7px - ); - display: grid; - place-items: center; - transition: transform 400ms ease; -} -.album-card__record::after { - content: ''; - width: 25%; - aspect-ratio: 1; - border-radius: 50%; - border: 1px solid var(--border-strong); - background: var(--surface-raised); +/* Two 18rem columns plus the 1.375rem gap no longer fit below this width. */ +@container album-grid (width < 37.375rem) { + .album-card { + max-width: 26rem; + margin-inline: auto; + } } .album-card__view { position: absolute; diff --git a/client/src/components/AlbumCard.test.tsx b/client/src/components/AlbumCard.test.tsx index ee3c8dc..6d063b8 100644 --- a/client/src/components/AlbumCard.test.tsx +++ b/client/src/components/AlbumCard.test.tsx @@ -71,6 +71,22 @@ it('shows a real aggregate rating and review count', () => { expect(screen.getByText('Average rating:')).toBeInTheDocument(); }); +it('renders the album cover beneath the existing View album overlay', () => { + const releaseGroupId = '004bf1bb-df91-4724-8292-6c50b73216b8'; + const { container } = render( + + + , + ); + const cover = container.querySelector('.album-card__cover'); + expect(cover?.querySelector('img')).toHaveAttribute( + 'src', + `https://coverartarchive.org/release-group/${releaseGroupId}/front-250`, + ); + expect(cover).toContainElement(screen.getByText('View album')); + expect(screen.getByRole('link', { name: album.title })).toBeInTheDocument(); +}); + it.each([false, true])( 'keeps keyboard navigation and the crate mutation separate (saved: %s)', async (saved) => { @@ -101,7 +117,13 @@ it.each([false, true])( }, ]} > - + , ); const link = screen.getByRole('link', { name: album.title }); diff --git a/client/src/components/AlbumCard.tsx b/client/src/components/AlbumCard.tsx index d752e08..35484d4 100644 --- a/client/src/components/AlbumCard.tsx +++ b/client/src/components/AlbumCard.tsx @@ -2,6 +2,7 @@ import './AlbumCard.css'; import type { AlbumSummary } from '../api/searchAlbums.js'; import CrateButton from './CrateButton.js'; +import AlbumCover from './AlbumCover.js'; export default function AlbumCard({ album }: { album: AlbumSummary }) { const detailHref = `${import.meta.env.BASE_URL}album/${album.id}${window.location.search}`; @@ -10,7 +11,10 @@ export default function AlbumCard({ album }: { album: AlbumSummary }) { return (
diff --git a/client/src/pages/AlbumDetailPage.css b/client/src/pages/AlbumDetailPage.css index 18d1721..14374c7 100644 --- a/client/src/pages/AlbumDetailPage.css +++ b/client/src/pages/AlbumDetailPage.css @@ -33,15 +33,35 @@ margin: 2rem 0; padding-bottom: 2.5rem; } -.album-detail__artwork { +.album-detail__artwork-column { width: 100%; max-width: 26rem; + min-width: 0; +} +.album-detail__artwork { + width: 100%; box-shadow: 0 0 4rem var(--surface-raised); } .album-detail__info { min-width: 0; overflow-wrap: anywhere; } +.album-detail__artwork-source { + /* Visibility reserves the caption's space while the image loads or fails. */ + display: inline-block; + margin-top: 0.75rem; + padding-block: 0.5rem; + color: var(--muted); + font-size: 0.8125rem; + text-underline-offset: 0.2em; +} +.album-detail__artwork-source:hover { + color: var(--accent); +} +.album-detail__artwork-source:focus-visible { + outline: 3px solid var(--focus); + outline-offset: 4px; +} .album-detail__header h1 { font-size: clamp(2rem, 4.8vw, 4.75rem); letter-spacing: -0.05em; diff --git a/client/src/pages/AlbumDetailPage.test.tsx b/client/src/pages/AlbumDetailPage.test.tsx index 8b9331a..57b0c29 100644 --- a/client/src/pages/AlbumDetailPage.test.tsx +++ b/client/src/pages/AlbumDetailPage.test.tsx @@ -76,6 +76,9 @@ it('renders an album tracklist and its first page of reviews', async () => { 'true', ); expect(header.querySelector('img')).not.toBeInTheDocument(); + expect( + screen.queryByRole('link', { name: 'Artwork via Cover Art Archive' }), + ).not.toBeInTheDocument(); const tracklist = screen.getByRole('region', { name: 'Tracklist' }); expect(within(tracklist).getByText('On the record')).toBeInTheDocument(); expect(tracklist.querySelector('a, button, [tabindex]')).toBeNull(); @@ -89,6 +92,52 @@ it('renders an album tracklist and its first page of reviews', async () => { expect(within(reviews).getByLabelText('5 out of 5 stars')).toBeInTheDocument(); }); +it('shows shared detail artwork and an accessible source link, retaining the fallback on failure', async () => { + const releaseGroupId = '004bf1bb-df91-4724-8292-6c50b73216b8'; + const { container } = renderDetail({ musicBrainzReleaseGroupId: releaseGroupId }); + await screen.findByRole('heading', { name: 'Abbey Road' }); + const artwork = container.querySelector('.album-detail__artwork')!; + const image = artwork.querySelector('img')!; + expect(artwork.querySelector('.album-cover')).toBeInTheDocument(); + expect(image).toHaveAttribute( + 'src', + `https://coverartarchive.org/release-group/${releaseGroupId}/front-500`, + ); + expect(image).toHaveAttribute('loading', 'eager'); + expect(image).toHaveAttribute( + 'sizes', + '(max-width: 700px) min(26rem, calc(100vw - 2rem)), min(26rem, calc((100vw - 4rem - clamp(2rem, 5vw, 4.5rem)) * 0.4))', + ); + expect( + screen.queryByRole('link', { name: 'Artwork via Cover Art Archive' }), + ).not.toBeInTheDocument(); + const reservedSource = container.querySelector('.album-detail__artwork-source')!; + expect(reservedSource).not.toBeVisible(); + fireEvent.load(image); + const source = screen.getByRole('link', { name: 'Artwork via Cover Art Archive' }); + expect(source).toBeVisible(); + expect(source.parentElement).toBe(artwork.parentElement); + expect(artwork.nextElementSibling).toBe(source); + expect(source).toHaveAttribute( + 'href', + `https://musicbrainz.org/release-group/${releaseGroupId}`, + ); + expect(source.closest('[aria-hidden="true"]')).toBeNull(); + + fireEvent.error(image); + expect(artwork.querySelector('img')).toBeNull(); + expect(artwork.querySelector('.album-card__record')).toBeInTheDocument(); + expect(source).not.toBeVisible(); + expect( + screen.queryByRole('link', { name: 'Artwork via Cover Art Archive' }), + ).not.toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Add to crate' })).toBeEnabled(); + const audit = await axe.run(container, { + rules: { 'color-contrast': { enabled: false } }, + }); + expect(audit.violations.map((v) => v.id)).toEqual([]); +}); + it('omits missing secondary metadata and shows an unrated album without broken artwork', async () => { renderDetail({ title: '', diff --git a/client/src/pages/AlbumDetailPage.tsx b/client/src/pages/AlbumDetailPage.tsx index 36b9c6e..d2bf238 100644 --- a/client/src/pages/AlbumDetailPage.tsx +++ b/client/src/pages/AlbumDetailPage.tsx @@ -7,6 +7,7 @@ import { useQuery } from '@apollo/client/react'; import { ALBUM_DETAIL } from '../api/albumDetail.js'; import ReviewForm from '../components/ReviewForm.js'; import CrateButton from '../components/CrateButton.js'; +import AlbumCover from '../components/AlbumCover.js'; const REVIEW_PAGE_SIZE = 10; @@ -21,6 +22,7 @@ function formatDate(value: string): string { } export default function AlbumDetailPage({ id }: { id: string }) { + const [loadedArtworkId, setLoadedArtworkId] = useState(null); const [loadingMoreReviews, setLoadingMoreReviews] = useState(false); const [reviewsError, setReviewsError] = useState(null); const reviewStatusRef = useRef(null); @@ -117,8 +119,31 @@ export default function AlbumDetailPage({ id }: { id: string }) { ← Back to Discover
-