graphbrainz/src/types/release-group.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-08-08 07:54:06 +00:00
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 its 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 }
}
}
})
})