graphbrainz/src/types/label.js

46 lines
965 B
JavaScript
Raw Normal View History

2016-08-20 05:59:32 +00:00
import {
GraphQLObjectType,
GraphQLList,
GraphQLString,
GraphQLInt
} 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 { IPI } from './scalars'
import Area from './area'
import {
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-08-20 05:59:32 +00:00
name,
sortName,
disambiguation,
lifeSpan,
releases,
2016-08-31 06:33:29 +00:00
fieldWithID
2016-08-20 05:59:32 +00:00
} from './helpers'
const Label = new GraphQLObjectType({
name: 'Label',
description: 'Labels represent mostly (but not only) imprints.',
2016-08-31 06:33:29 +00:00
interfaces: () => [Node, Entity],
2016-08-20 05:59:32 +00:00
fields: () => ({
id,
2016-08-31 06:33:29 +00:00
mbid,
2016-08-20 05:59:32 +00:00
name,
sortName,
disambiguation,
country: { type: GraphQLString },
area: { type: Area },
lifeSpan,
labelCode: { type: GraphQLInt },
ipis: { type: new GraphQLList(IPI) },
...fieldWithID('type'),
releases
})
})
2016-08-31 06:33:29 +00:00
const { connectionType: LabelConnection } = connectionDefinitions({ nodeType: Label })
export { LabelConnection }
2016-08-20 05:59:32 +00:00
export default Label