graphbrainz/src/types/place.js

45 lines
1,000 B
JavaScript
Raw Normal View History

2016-08-20 05:59:32 +00:00
import { GraphQLObjectType, GraphQLString } from 'graphql/type'
import Entity from './entity'
import { Degrees } from './scalars'
import Area from './area'
import {
id,
name,
disambiguation,
lifeSpan,
events,
fieldWithID,
createPageType
} from './helpers'
2016-08-08 07:54:06 +00:00
2016-08-20 05:59:32 +00:00
export const Coordinates = new GraphQLObjectType({
name: 'Coordinates',
description: 'Geographic coordinates with latitude and longitude.',
fields: () => ({
latitude: { type: Degrees },
longitude: { type: Degrees }
})
})
const Place = new GraphQLObjectType({
2016-08-08 07:54:06 +00:00
name: 'Place',
description:
'A venue, studio or other place where music is performed, recorded, ' +
'engineered, etc.',
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,
name,
disambiguation,
2016-08-08 07:54:06 +00:00
address: { type: GraphQLString },
2016-08-20 05:59:32 +00:00
area: { type: Area },
coordinates: { type: Coordinates },
lifeSpan,
...fieldWithID('type'),
events
2016-08-08 07:54:06 +00:00
})
})
2016-08-20 05:59:32 +00:00
export const PlacePage = createPageType(Place)
export default Place