mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
|
|
import {
|
|||
|
|
GraphQLObjectType,
|
|||
|
|
GraphQLNonNull,
|
|||
|
|
GraphQLString,
|
|||
|
|
GraphQLList
|
|||
|
|
} from 'graphql/type'
|
|||
|
|
import MBID from './mbid'
|
|||
|
|
import DateType from './date'
|
|||
|
|
import ArtistCreditType from './artist-credit'
|
|||
|
|
import ReleaseType from './release'
|
|||
|
|
import { getHyphenated, fieldWithID, getByline } from './helpers'
|
|||
|
|
|
|||
|
|
export default new GraphQLObjectType({
|
|||
|
|
name: 'ReleaseGroup',
|
|||
|
|
description:
|
|||
|
|
'Represents an abstract "album" (or "single", or "EP") entity. ' +
|
|||
|
|
'Technically it’s a group of releases, with a specified type.',
|
|||
|
|
fields: () => ({
|
|||
|
|
id: { type: new GraphQLNonNull(MBID) },
|
|||
|
|
title: { type: GraphQLString },
|
|||
|
|
disambiguation: { type: GraphQLString },
|
|||
|
|
firstReleaseDate: { type: DateType, resolve: getHyphenated },
|
|||
|
|
...fieldWithID('primaryType'),
|
|||
|
|
...fieldWithID('secondaryTypes', { type: new GraphQLList(GraphQLString) }),
|
|||
|
|
artists: {
|
|||
|
|
type: new GraphQLList(ArtistCreditType),
|
|||
|
|
resolve: data => data['artist-credit']
|
|||
|
|
},
|
|||
|
|
artistByline: { type: GraphQLString, resolve: getByline },
|
|||
|
|
releases: {
|
|||
|
|
type: new GraphQLList(ReleaseType),
|
|||
|
|
args: {
|
|||
|
|
type: { type: GraphQLString },
|
|||
|
|
status: { type: GraphQLString }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
})
|