graphbrainz/src/types/place.js

75 lines
1.8 KiB
JavaScript
Raw Normal View History

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,
aliases,
2016-08-20 05:59:32 +00:00
lifeSpan,
events,
fieldWithID,
relationships,
collections,
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 northsouth position of a point on the Earths surface.'
},
longitude: {
type: Degrees,
description: 'The eastwest position of a point on the Earths surface.'
}
2016-08-20 05:59:32 +00:00
})
})
const Place = new GraphQLObjectType({
2016-08-08 07:54:06 +00:00
name: 'Place',
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,
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.`
}),
events,
relationships,
collections,
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