2016-08-20 05:59:32 +00:00
|
|
|
|
import { GraphQLObjectType, GraphQLString } from 'graphql/type'
|
2016-08-31 06:33:29 +00:00
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
|
import Entity from './entity'
|
|
|
|
|
|
import { Degrees } 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,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
lifeSpan,
|
|
|
|
|
|
events,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
fieldWithID,
|
|
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags,
|
2016-11-28 14:43:32 +00:00
|
|
|
|
connectionWithExtras
|
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
|
|
|
|
export const Coordinates = new GraphQLObjectType({
|
|
|
|
|
|
name: 'Coordinates',
|
2016-11-26 01:38:32 +00:00
|
|
|
|
description: 'Geographic coordinates described with latitude and longitude.',
|
2016-08-20 05:59:32 +00:00
|
|
|
|
fields: () => ({
|
2016-11-26 01:38:32 +00:00
|
|
|
|
latitude: {
|
|
|
|
|
|
type: Degrees,
|
|
|
|
|
|
description: 'The north–south position of a point on the Earth’s surface.'
|
|
|
|
|
|
},
|
|
|
|
|
|
longitude: {
|
|
|
|
|
|
type: Degrees,
|
|
|
|
|
|
description: 'The east–west position of a point on the Earth’s surface.'
|
|
|
|
|
|
}
|
2016-08-20 05:59:32 +00:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const Place = new GraphQLObjectType({
|
2016-08-08 07:54:06 +00:00
|
|
|
|
name: 'Place',
|
2016-11-30 02:18:50 +00:00
|
|
|
|
description: `A [place](https://musicbrainz.org/doc/Place) is a venue, studio,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
or other place where music is performed, recorded, engineered, etc.`,
|
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
|
|
|
|
name,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
address: {
|
|
|
|
|
|
type: GraphQLString,
|
|
|
|
|
|
description: `The address describes the location of the place using the
|
|
|
|
|
|
standard addressing format for the country it is located in.`
|
|
|
|
|
|
},
|
|
|
|
|
|
area: {
|
|
|
|
|
|
type: Area,
|
|
|
|
|
|
description: `The area entity representing the area, such as the city, in
|
|
|
|
|
|
which the place is located.`
|
|
|
|
|
|
},
|
|
|
|
|
|
coordinates: {
|
|
|
|
|
|
type: Coordinates,
|
|
|
|
|
|
description: 'The geographic coordinates of the place.'
|
|
|
|
|
|
},
|
2016-08-20 05:59:32 +00:00
|
|
|
|
lifeSpan,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
...fieldWithID('type', {
|
|
|
|
|
|
description: `The type categorises the place based on its primary
|
|
|
|
|
|
function.`
|
|
|
|
|
|
}),
|
2016-11-28 13:49:04 +00:00
|
|
|
|
events,
|
|
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags
|
2016-08-08 07:54:06 +00:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
|
2016-11-28 14:43:32 +00:00
|
|
|
|
export const PlaceConnection = connectionWithExtras(Place)
|
2016-08-20 05:59:32 +00:00
|
|
|
|
export default Place
|