graphbrainz/src/types/release-group.js

39 lines
958 B
JavaScript
Raw Normal View History

2016-08-20 05:59:32 +00:00
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql/type'
import Entity from './entity'
import { DateType } from './scalars'
2016-08-08 07:54:06 +00:00
import {
2016-08-20 05:59:32 +00:00
id,
title,
disambiguation,
artistCredit,
artists,
releases,
relations,
getHyphenated,
fieldWithID,
createPageType
} from './helpers'
2016-08-08 07:54:06 +00:00
2016-08-20 05:59:32 +00:00
const ReleaseGroup = new GraphQLObjectType({
2016-08-08 07:54:06 +00:00
name: 'ReleaseGroup',
description:
'Represents an abstract "album" (or "single", or "EP") entity. ' +
'Technically its a group of releases, with a specified type.',
2016-08-20 05:59:32 +00:00
interfaces: () => [Entity],
2016-08-08 07:54:06 +00:00
fields: () => ({
2016-08-20 05:59:32 +00:00
id,
title,
disambiguation,
artistCredit,
2016-08-08 07:54:06 +00:00
firstReleaseDate: { type: DateType, resolve: getHyphenated },
...fieldWithID('primaryType'),
...fieldWithID('secondaryTypes', { type: new GraphQLList(GraphQLString) }),
2016-08-20 05:59:32 +00:00
artists,
releases,
relations
2016-08-08 07:54:06 +00:00
})
})
2016-08-20 05:59:32 +00:00
export const ReleaseGroupPage = createPageType(ReleaseGroup)
export default ReleaseGroup