2016-08-31 06:33:29 +00:00
|
|
|
import { GraphQLObjectType, GraphQLString, GraphQLList } from 'graphql'
|
|
|
|
|
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,
|
2016-11-28 13:49:04 +00:00
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
artists,
|
|
|
|
|
events,
|
|
|
|
|
labels,
|
|
|
|
|
places,
|
2016-11-28 13:49:04 +00:00
|
|
|
releases,
|
|
|
|
|
relationships,
|
|
|
|
|
tags,
|
|
|
|
|
connectionWithCount
|
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,
|
2016-11-28 13:49:04 +00:00
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
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,
|
2016-11-28 13:49:04 +00:00
|
|
|
releases,
|
|
|
|
|
relationships,
|
|
|
|
|
tags
|
2016-08-08 07:54:06 +00:00
|
|
|
})
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
2016-11-28 13:49:04 +00:00
|
|
|
export const AreaConnection = connectionWithCount(Area)
|
2016-08-20 05:59:32 +00:00
|
|
|
export default Area
|