2016-08-31 06:33:29 +00:00
|
|
|
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql'
|
|
|
|
|
import { connectionDefinitions } from 'graphql-relay'
|
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
import Entity from './entity'
|
2016-08-08 07:54:06 +00:00
|
|
|
import {
|
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,
|
|
|
|
|
sortName,
|
|
|
|
|
disambiguation,
|
|
|
|
|
artists,
|
|
|
|
|
events,
|
|
|
|
|
labels,
|
|
|
|
|
places,
|
2016-08-31 06:33:29 +00:00
|
|
|
releases
|
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
|
|
|
const Area = new GraphQLObjectType({
|
2016-08-08 07:54:06 +00:00
|
|
|
name: 'Area',
|
2016-11-26 01:38:32 +00:00
|
|
|
description: `[Areas](https://musicbrainz.org/doc/Area) are geographic regions
|
|
|
|
|
or settlements (countries, cities, or the like).`,
|
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,
|
|
|
|
|
sortName,
|
|
|
|
|
disambiguation,
|
|
|
|
|
isoCodes: {
|
|
|
|
|
type: new GraphQLList(GraphQLString),
|
2016-11-26 01:38:32 +00:00
|
|
|
description: `[ISO 3166 codes](https://en.wikipedia.org/wiki/ISO_3166) are
|
|
|
|
|
the codes assigned by ISO to countries and subdivisions.`,
|
2016-08-20 05:59:32 +00:00
|
|
|
resolve: data => data['iso-3166-1-codes']
|
|
|
|
|
},
|
|
|
|
|
artists,
|
|
|
|
|
events,
|
|
|
|
|
labels,
|
|
|
|
|
places,
|
|
|
|
|
releases
|
2016-08-08 07:54:06 +00:00
|
|
|
})
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
2016-08-31 06:33:29 +00:00
|
|
|
const { connectionType: AreaConnection } = connectionDefinitions({ nodeType: Area })
|
|
|
|
|
export { AreaConnection }
|
2016-08-20 05:59:32 +00:00
|
|
|
export default Area
|