graphbrainz/src/types/place.js

31 lines
936 B
JavaScript
Raw Normal View History

2016-08-08 07:54:06 +00:00
import { GraphQLObjectType, GraphQLNonNull, GraphQLString } from 'graphql/type'
import MBID from './mbid'
import AreaType from './area'
import LifeSpanType from './life-span'
import { getHyphenated, fieldWithID } from './helpers'
export default new GraphQLObjectType({
name: 'Place',
description:
'A venue, studio or other place where music is performed, recorded, ' +
'engineered, etc.',
fields: () => ({
id: { type: new GraphQLNonNull(MBID) },
name: { type: GraphQLString },
disambiguation: { type: GraphQLString },
address: { type: GraphQLString },
area: { type: AreaType },
coordinates: {
type: new GraphQLObjectType({
name: 'Coordinates',
fields: () => ({
latitude: { type: GraphQLString },
longitude: { type: GraphQLString }
})
})
},
lifeSpan: { type: LifeSpanType, resolve: getHyphenated },
...fieldWithID('type')
})
})