2016-08-20 05:59:32 +00:00
|
|
|
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql/type'
|
2016-08-31 06:33:29 +00:00
|
|
|
import { connectionDefinitions } from 'graphql-relay'
|
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
import Entity from './entity'
|
|
|
|
|
import { DateType } from './scalars'
|
|
|
|
|
import ReleaseEvent from './release-event'
|
2016-08-08 07:54:06 +00:00
|
|
|
import {
|
2016-08-20 05:59:32 +00:00
|
|
|
id,
|
2016-08-31 06:33:29 +00:00
|
|
|
mbid,
|
2016-08-20 05:59:32 +00:00
|
|
|
title,
|
|
|
|
|
disambiguation,
|
|
|
|
|
artistCredit,
|
|
|
|
|
artists,
|
|
|
|
|
labels,
|
|
|
|
|
recordings,
|
|
|
|
|
releaseGroups,
|
|
|
|
|
relations,
|
|
|
|
|
getHyphenated,
|
2016-08-31 06:33:29 +00:00
|
|
|
fieldWithID
|
2016-08-20 05:59:32 +00:00
|
|
|
} from './helpers'
|
2016-08-08 07:54:06 +00:00
|
|
|
|
2016-08-20 05:59:32 +00:00
|
|
|
const Release = new GraphQLObjectType({
|
2016-08-08 07:54:06 +00:00
|
|
|
name: 'Release',
|
|
|
|
|
description:
|
|
|
|
|
'Real-world release object you can buy in your music store. It has ' +
|
|
|
|
|
'release date and country, list of catalog number and label pairs, ' +
|
|
|
|
|
'packaging type and release status.',
|
2016-08-31 06:33:29 +00:00
|
|
|
interfaces: () => [Node, Entity],
|
2016-08-08 07:54:06 +00:00
|
|
|
fields: () => ({
|
2016-08-20 05:59:32 +00:00
|
|
|
id,
|
2016-08-31 06:33:29 +00:00
|
|
|
mbid,
|
2016-08-20 05:59:32 +00:00
|
|
|
title,
|
|
|
|
|
disambiguation,
|
|
|
|
|
artistCredit,
|
2016-08-08 07:54:06 +00:00
|
|
|
releaseEvents: {
|
2016-08-20 05:59:32 +00:00
|
|
|
type: new GraphQLList(ReleaseEvent),
|
2016-08-08 07:54:06 +00:00
|
|
|
resolve: getHyphenated
|
|
|
|
|
},
|
|
|
|
|
date: { type: DateType },
|
|
|
|
|
country: { type: GraphQLString },
|
|
|
|
|
barcode: { type: GraphQLString },
|
|
|
|
|
...fieldWithID('status'),
|
|
|
|
|
...fieldWithID('packaging'),
|
2016-08-20 05:59:32 +00:00
|
|
|
quality: { type: GraphQLString },
|
|
|
|
|
artists,
|
|
|
|
|
labels,
|
|
|
|
|
recordings,
|
|
|
|
|
releaseGroups,
|
|
|
|
|
relations
|
2016-08-08 07:54:06 +00:00
|
|
|
})
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
2016-08-31 06:33:29 +00:00
|
|
|
const { connectionType: ReleaseConnection } = connectionDefinitions({ nodeType: Release })
|
|
|
|
|
export { ReleaseConnection }
|
2016-08-20 05:59:32 +00:00
|
|
|
export default Release
|