graphbrainz/src/types/area.js

43 lines
857 B
JavaScript
Raw Normal View History

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',
description: 'A country, region, city 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),
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