mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
wip
This commit is contained in:
parent
ed5339f2e1
commit
116775eaca
5 changed files with 180 additions and 270 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
import { GraphQLObjectType, GraphQLInt } from 'graphql'
|
import { GraphQLObjectType } from 'graphql'
|
||||||
|
import { forwardConnectionArgs } from 'graphql-relay'
|
||||||
|
import { browseResolver } from '../resolvers'
|
||||||
import {
|
import {
|
||||||
MBID,
|
MBID,
|
||||||
URLString,
|
URLString,
|
||||||
|
|
@ -12,7 +14,17 @@ import {
|
||||||
URLConnection,
|
URLConnection,
|
||||||
WorkConnection
|
WorkConnection
|
||||||
} from '../types'
|
} from '../types'
|
||||||
import { browseResolver } from '../resolvers'
|
|
||||||
|
function browseQuery (connectionType, args) {
|
||||||
|
return {
|
||||||
|
type: connectionType,
|
||||||
|
args: {
|
||||||
|
...forwardConnectionArgs,
|
||||||
|
...args
|
||||||
|
},
|
||||||
|
resolve: browseResolver()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new GraphQLObjectType({
|
export default new GraphQLObjectType({
|
||||||
name: 'BrowseQuery',
|
name: 'BrowseQuery',
|
||||||
|
|
@ -20,101 +32,47 @@ export default new GraphQLObjectType({
|
||||||
'Browse requests are a direct lookup of all the entities directly linked ' +
|
'Browse requests are a direct lookup of all the entities directly linked ' +
|
||||||
'to another entity.',
|
'to another entity.',
|
||||||
fields: {
|
fields: {
|
||||||
artists: {
|
artists: browseQuery(ArtistConnection, {
|
||||||
type: ArtistConnection,
|
area: { type: MBID },
|
||||||
args: {
|
recording: { type: MBID },
|
||||||
limit: { type: GraphQLInt },
|
release: { type: MBID },
|
||||||
offset: { type: GraphQLInt },
|
releaseGroup: { type: MBID },
|
||||||
area: { type: MBID },
|
work: { type: MBID }
|
||||||
recording: { type: MBID },
|
}),
|
||||||
release: { type: MBID },
|
events: browseQuery(EventConnection, {
|
||||||
releaseGroup: { type: MBID },
|
area: { type: MBID },
|
||||||
work: { type: MBID }
|
artist: { type: MBID },
|
||||||
},
|
place: { type: MBID }
|
||||||
resolve: browseResolver()
|
}),
|
||||||
},
|
labels: browseQuery(LabelConnection, {
|
||||||
events: {
|
area: { type: MBID },
|
||||||
type: EventConnection,
|
release: { type: MBID }
|
||||||
args: {
|
}),
|
||||||
limit: { type: GraphQLInt },
|
places: browseQuery(PlaceConnection, {
|
||||||
offset: { type: GraphQLInt },
|
area: { type: MBID }
|
||||||
area: { type: MBID },
|
}),
|
||||||
artist: { type: MBID },
|
recordings: browseQuery(RecordingConnection, {
|
||||||
place: { type: MBID }
|
artist: { type: MBID },
|
||||||
},
|
release: { type: MBID }
|
||||||
resolve: browseResolver()
|
}),
|
||||||
},
|
releases: browseQuery(ReleaseConnection, {
|
||||||
labels: {
|
area: { type: MBID },
|
||||||
type: LabelConnection,
|
artist: { type: MBID },
|
||||||
args: {
|
label: { type: MBID },
|
||||||
limit: { type: GraphQLInt },
|
track: { type: MBID },
|
||||||
offset: { type: GraphQLInt },
|
trackArtist: { type: MBID },
|
||||||
area: { type: MBID },
|
recording: { type: MBID },
|
||||||
release: { type: MBID }
|
releaseGroup: { type: MBID }
|
||||||
},
|
}),
|
||||||
resolve: browseResolver()
|
releaseGroups: browseQuery(ReleaseGroupConnection, {
|
||||||
},
|
artist: { type: MBID },
|
||||||
places: {
|
release: { type: MBID }
|
||||||
type: PlaceConnection,
|
}),
|
||||||
args: {
|
works: browseQuery(WorkConnection, {
|
||||||
limit: { type: GraphQLInt },
|
artist: { type: MBID }
|
||||||
offset: { type: GraphQLInt },
|
}),
|
||||||
area: { type: MBID }
|
urls: browseQuery(URLConnection, {
|
||||||
},
|
resource: { type: URLString }
|
||||||
resolve: browseResolver()
|
})
|
||||||
},
|
|
||||||
recordings: {
|
|
||||||
type: RecordingConnection,
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
artist: { type: MBID },
|
|
||||||
release: { type: MBID }
|
|
||||||
},
|
|
||||||
resolve: browseResolver()
|
|
||||||
},
|
|
||||||
releases: {
|
|
||||||
type: ReleaseConnection,
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
area: { type: MBID },
|
|
||||||
artist: { type: MBID },
|
|
||||||
label: { type: MBID },
|
|
||||||
track: { type: MBID },
|
|
||||||
trackArtist: { type: MBID },
|
|
||||||
recording: { type: MBID },
|
|
||||||
releaseGroup: { type: MBID }
|
|
||||||
},
|
|
||||||
resolve: browseResolver()
|
|
||||||
},
|
|
||||||
releaseGroups: {
|
|
||||||
type: ReleaseGroupConnection,
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
artist: { type: MBID },
|
|
||||||
release: { type: MBID }
|
|
||||||
},
|
|
||||||
resolve: browseResolver()
|
|
||||||
},
|
|
||||||
works: {
|
|
||||||
type: WorkConnection,
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
artist: { type: MBID }
|
|
||||||
},
|
|
||||||
resolve: browseResolver()
|
|
||||||
},
|
|
||||||
urls: {
|
|
||||||
type: URLConnection,
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
resource: { type: URLString }
|
|
||||||
},
|
|
||||||
resolve: browseResolver()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import { GraphQLObjectType } from 'graphql'
|
import { GraphQLObjectType } from 'graphql'
|
||||||
|
import { lookupResolver } from '../resolvers'
|
||||||
|
import { mbid } from '../types/helpers'
|
||||||
import {
|
import {
|
||||||
Area,
|
Area,
|
||||||
Artist,
|
Artist,
|
||||||
|
|
@ -9,10 +11,19 @@ import {
|
||||||
Recording,
|
Recording,
|
||||||
Release,
|
Release,
|
||||||
ReleaseGroup,
|
ReleaseGroup,
|
||||||
|
Series,
|
||||||
URL,
|
URL,
|
||||||
Work
|
Work
|
||||||
} from '../types'
|
} from '../types'
|
||||||
import { lookupQuery } from '../types/helpers'
|
|
||||||
|
function lookupQuery (entity) {
|
||||||
|
return {
|
||||||
|
type: entity,
|
||||||
|
description: `Look up a specific ${entity.name} by its MBID.`,
|
||||||
|
args: { mbid },
|
||||||
|
resolve: lookupResolver()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new GraphQLObjectType({
|
export default new GraphQLObjectType({
|
||||||
name: 'LookupQuery',
|
name: 'LookupQuery',
|
||||||
|
|
@ -29,6 +40,7 @@ export default new GraphQLObjectType({
|
||||||
recording: lookupQuery(Recording),
|
recording: lookupQuery(Recording),
|
||||||
release: lookupQuery(Release),
|
release: lookupQuery(Release),
|
||||||
releaseGroup: lookupQuery(ReleaseGroup),
|
releaseGroup: lookupQuery(ReleaseGroup),
|
||||||
|
series: lookupQuery(Series),
|
||||||
url: lookupQuery(URL),
|
url: lookupQuery(URL),
|
||||||
work: lookupQuery(Work)
|
work: lookupQuery(Work)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import { GraphQLObjectType } from 'graphql'
|
import { GraphQLObjectType, GraphQLNonNull, GraphQLString } from 'graphql'
|
||||||
|
import { forwardConnectionArgs } from 'graphql-relay'
|
||||||
|
import { searchResolver } from '../resolvers'
|
||||||
import {
|
import {
|
||||||
AreaConnection,
|
AreaConnection,
|
||||||
ArtistConnection,
|
ArtistConnection,
|
||||||
|
|
@ -9,7 +11,17 @@ import {
|
||||||
ReleaseGroupConnection,
|
ReleaseGroupConnection,
|
||||||
WorkConnection
|
WorkConnection
|
||||||
} from '../types'
|
} from '../types'
|
||||||
import { searchQuery } from '../types/helpers'
|
|
||||||
|
function searchQuery (connectionType) {
|
||||||
|
return {
|
||||||
|
type: connectionType,
|
||||||
|
args: {
|
||||||
|
query: { type: new GraphQLNonNull(GraphQLString) },
|
||||||
|
...forwardConnectionArgs
|
||||||
|
},
|
||||||
|
resolve: searchResolver()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new GraphQLObjectType({
|
export default new GraphQLObjectType({
|
||||||
name: 'SearchQuery',
|
name: 'SearchQuery',
|
||||||
|
|
|
||||||
105
src/resolvers.js
105
src/resolvers.js
|
|
@ -1,5 +1,9 @@
|
||||||
import { toEntityType } from './types/helpers'
|
import { toEntityType } from './types/helpers'
|
||||||
import { getOffsetWithDefault, connectionFromArraySlice } from 'graphql-relay'
|
import {
|
||||||
|
getOffsetWithDefault,
|
||||||
|
connectionFromArray,
|
||||||
|
connectionFromArraySlice
|
||||||
|
} from 'graphql-relay'
|
||||||
import { getFields, extendIncludes } from './util'
|
import { getFields, extendIncludes } from './util'
|
||||||
|
|
||||||
export function includeRelations (params, info) {
|
export function includeRelations (params, info) {
|
||||||
|
|
@ -35,34 +39,63 @@ export function includeSubqueries (params, info) {
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
export function lookupResolver (entityType, extraParams = {}) {
|
export function lookupResolver () {
|
||||||
return (root, { id }, { lookupLoader }, info) => {
|
return (root, { mbid }, { lookupLoader }, info) => {
|
||||||
const params = includeRelations(extraParams, info)
|
const entityType = toEntityType(info.fieldName)
|
||||||
entityType = entityType || toEntityType(info.fieldName)
|
const params = includeRelations({}, info)
|
||||||
return lookupLoader.load([entityType, id, params])
|
return lookupLoader.load([entityType, mbid, params])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function browseResolver () {
|
export function browseResolver () {
|
||||||
return (source, args, { browseLoader }, info) => {
|
return (source, { first = 25, after, ...args }, { browseLoader }, info) => {
|
||||||
const pluralName = toEntityType(info.fieldName)
|
const pluralName = toEntityType(info.fieldName)
|
||||||
let singularName = pluralName
|
let singularName = pluralName
|
||||||
if (pluralName.endsWith('s')) {
|
if (pluralName.endsWith('s')) {
|
||||||
singularName = pluralName.slice(0, -1)
|
singularName = pluralName.slice(0, -1)
|
||||||
}
|
}
|
||||||
const params = args
|
const { type, types, status, statuses, ...moreParams } = args
|
||||||
return browseLoader.load([singularName, params])
|
let params = {
|
||||||
|
...moreParams,
|
||||||
|
type: [],
|
||||||
|
status: [],
|
||||||
|
limit: first,
|
||||||
|
offset: getOffsetWithDefault(after, 0)
|
||||||
|
}
|
||||||
|
params = includeSubqueries(params, info)
|
||||||
|
params = includeRelations(params, info)
|
||||||
|
if (type) {
|
||||||
|
params.type.push(type)
|
||||||
|
}
|
||||||
|
if (types) {
|
||||||
|
params.type.push(...types)
|
||||||
|
}
|
||||||
|
if (status) {
|
||||||
|
params.status.push(status)
|
||||||
|
}
|
||||||
|
if (statuses) {
|
||||||
|
params.status.push(...statuses)
|
||||||
|
}
|
||||||
|
return browseLoader.load([singularName, params]).then(list => {
|
||||||
|
const {
|
||||||
|
[pluralName]: arraySlice,
|
||||||
|
[`${singularName}-offset`]: sliceStart,
|
||||||
|
[`${singularName}-count`]: arrayLength
|
||||||
|
} = list
|
||||||
|
const meta = { sliceStart, arrayLength }
|
||||||
|
return connectionFromArraySlice(arraySlice, { first, after }, meta)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function searchResolver () {
|
export function searchResolver () {
|
||||||
return (source, args, { searchLoader }, info) => {
|
return (source, { first = 25, after, ...args }, { searchLoader }, info) => {
|
||||||
const pluralName = toEntityType(info.fieldName)
|
const pluralName = toEntityType(info.fieldName)
|
||||||
let singularName = pluralName
|
let singularName = pluralName
|
||||||
if (pluralName.endsWith('s')) {
|
if (pluralName.endsWith('s')) {
|
||||||
singularName = pluralName.slice(0, -1)
|
singularName = pluralName.slice(0, -1)
|
||||||
}
|
}
|
||||||
const { query, first, after, ...params } = args
|
const { query, ...params } = args
|
||||||
params.limit = first
|
params.limit = first
|
||||||
params.offset = getOffsetWithDefault(after, 0)
|
params.offset = getOffsetWithDefault(after, 0)
|
||||||
return searchLoader.load([singularName, query, params]).then(list => {
|
return searchLoader.load([singularName, query, params]).then(list => {
|
||||||
|
|
@ -78,61 +111,31 @@ export function searchResolver () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function relationResolver () {
|
export function relationResolver () {
|
||||||
return (source, { offset = 0,
|
return (source, args, context, info) => {
|
||||||
limit,
|
|
||||||
direction,
|
|
||||||
type,
|
|
||||||
typeID }, { lookupLoader }, info) => {
|
|
||||||
const targetType = toEntityType(info.fieldName).replace('-', '_')
|
const targetType = toEntityType(info.fieldName).replace('-', '_')
|
||||||
return source.filter(relation => {
|
const relations = source.filter(relation => {
|
||||||
if (relation['target-type'] !== targetType) {
|
if (relation['target-type'] !== targetType) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (direction != null && relation.direction !== direction) {
|
if (args.direction != null && relation.direction !== args.direction) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (type != null && relation.type !== type) {
|
if (args.type != null && relation.type !== args.type) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (typeID != null && relation['type-id'] !== typeID) {
|
if (args.typeID != null && relation['type-id'] !== args.typeID) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}).slice(offset, limit == null ? undefined : offset + limit)
|
})
|
||||||
|
return connectionFromArray(relations, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function linkedResolver () {
|
export function linkedResolver () {
|
||||||
return (source, args, { browseLoader }, info) => {
|
return (source, args, context, info) => {
|
||||||
const pluralName = toEntityType(info.fieldName)
|
|
||||||
let singularName = pluralName
|
|
||||||
if (pluralName.endsWith('s')) {
|
|
||||||
singularName = pluralName.slice(0, -1)
|
|
||||||
}
|
|
||||||
const parentEntity = toEntityType(info.parentType.name)
|
const parentEntity = toEntityType(info.parentType.name)
|
||||||
let params = {
|
args = { ...args, [parentEntity]: source.id }
|
||||||
[parentEntity]: source.id,
|
return browseResolver()(source, args, context, info)
|
||||||
type: [],
|
|
||||||
status: [],
|
|
||||||
limit: args.limit,
|
|
||||||
offset: args.offset
|
|
||||||
}
|
|
||||||
params = includeSubqueries(params, info)
|
|
||||||
params = includeRelations(params, info)
|
|
||||||
if (args.type) {
|
|
||||||
params.type.push(args.type)
|
|
||||||
}
|
|
||||||
if (args.types) {
|
|
||||||
params.type.push(...args.types)
|
|
||||||
}
|
|
||||||
if (args.status) {
|
|
||||||
params.status.push(args.status)
|
|
||||||
}
|
|
||||||
if (args.statuses) {
|
|
||||||
params.status.push(...args.statuses)
|
|
||||||
}
|
|
||||||
return browseLoader.load([singularName, params]).then(list => {
|
|
||||||
return list[pluralName]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,44 +3,36 @@ import pascalCase from 'pascalcase'
|
||||||
import {
|
import {
|
||||||
GraphQLObjectType,
|
GraphQLObjectType,
|
||||||
GraphQLString,
|
GraphQLString,
|
||||||
GraphQLInt,
|
|
||||||
GraphQLList,
|
GraphQLList,
|
||||||
GraphQLNonNull
|
GraphQLNonNull
|
||||||
} from 'graphql'
|
} from 'graphql'
|
||||||
import { globalIdField, forwardConnectionArgs } from 'graphql-relay'
|
import {
|
||||||
|
globalIdField,
|
||||||
|
connectionArgs,
|
||||||
|
forwardConnectionArgs
|
||||||
|
} from 'graphql-relay'
|
||||||
import { MBID } from './scalars'
|
import { MBID } from './scalars'
|
||||||
import { ReleaseGroupType, ReleaseStatus } from './enums'
|
import { ReleaseGroupType, ReleaseStatus } from './enums'
|
||||||
import ArtistCredit from './artist-credit'
|
import ArtistCredit from './artist-credit'
|
||||||
import Artist from './artist'
|
import { ArtistConnection } from './artist'
|
||||||
import Event from './event'
|
import { EventConnection } from './event'
|
||||||
import Label from './label'
|
import { LabelConnection } from './label'
|
||||||
import LifeSpan from './life-span'
|
import LifeSpan from './life-span'
|
||||||
import Place from './place'
|
import { PlaceConnection } from './place'
|
||||||
import Recording from './recording'
|
import { RecordingConnection } from './recording'
|
||||||
import Relation from './relation'
|
import Relation from './relation'
|
||||||
import Release from './release'
|
import { ReleaseConnection } from './release'
|
||||||
import ReleaseGroup from './release-group'
|
import { ReleaseGroupConnection } from './release-group'
|
||||||
import Work from './work'
|
import { WorkConnection } from './work'
|
||||||
import {
|
import {
|
||||||
lookupResolver,
|
|
||||||
linkedResolver,
|
linkedResolver,
|
||||||
relationResolver,
|
relationResolver,
|
||||||
searchResolver,
|
|
||||||
includeRelations
|
includeRelations
|
||||||
} from '../resolvers'
|
} from '../resolvers'
|
||||||
|
|
||||||
export const toNodeType = pascalCase
|
export const toNodeType = pascalCase
|
||||||
export const toEntityType = dashify
|
export const toEntityType = dashify
|
||||||
|
|
||||||
export function getByline (data) {
|
|
||||||
const credit = data['artist-credit']
|
|
||||||
if (credit && credit.length) {
|
|
||||||
return credit.reduce((byline, credit) => {
|
|
||||||
return byline + credit.name + credit.joinphrase
|
|
||||||
}, '')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function fieldWithID (name, config = {}) {
|
export function fieldWithID (name, config = {}) {
|
||||||
config = {
|
config = {
|
||||||
type: GraphQLString,
|
type: GraphQLString,
|
||||||
|
|
@ -76,29 +68,10 @@ export function getFallback (keys) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function lookupQuery (entity, params) {
|
|
||||||
return {
|
|
||||||
type: entity,
|
|
||||||
description: `Look up a specific ${entity.name} by its MBID.`,
|
|
||||||
args: { id },
|
|
||||||
resolve: lookupResolver(dashify(entity.name), params)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function searchQuery (connectionType) {
|
|
||||||
return {
|
|
||||||
type: connectionType,
|
|
||||||
args: {
|
|
||||||
query: { type: new GraphQLNonNull(GraphQLString) },
|
|
||||||
...forwardConnectionArgs
|
|
||||||
},
|
|
||||||
resolve: searchResolver()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const id = globalIdField()
|
export const id = globalIdField()
|
||||||
export const mbid = {
|
export const mbid = {
|
||||||
type: new GraphQLNonNull(MBID),
|
type: new GraphQLNonNull(MBID),
|
||||||
|
description: 'The MBID of the entity.',
|
||||||
resolve: source => source.id
|
resolve: source => source.id
|
||||||
}
|
}
|
||||||
export const name = { type: GraphQLString }
|
export const name = { type: GraphQLString }
|
||||||
|
|
@ -107,11 +80,21 @@ export const title = { type: GraphQLString }
|
||||||
export const disambiguation = { type: GraphQLString }
|
export const disambiguation = { type: GraphQLString }
|
||||||
export const lifeSpan = { type: LifeSpan, resolve: getHyphenated }
|
export const lifeSpan = { type: LifeSpan, resolve: getHyphenated }
|
||||||
|
|
||||||
|
function linkedQuery (connectionType, args) {
|
||||||
|
return {
|
||||||
|
type: connectionType,
|
||||||
|
args: {
|
||||||
|
...forwardConnectionArgs,
|
||||||
|
...args
|
||||||
|
},
|
||||||
|
resolve: linkedResolver()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const relation = {
|
export const relation = {
|
||||||
type: new GraphQLList(Relation),
|
type: new GraphQLList(Relation),
|
||||||
args: {
|
args: {
|
||||||
limit: { type: GraphQLInt },
|
...connectionArgs,
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
direction: { type: GraphQLString },
|
direction: { type: GraphQLString },
|
||||||
type: { type: GraphQLString },
|
type: { type: GraphQLString },
|
||||||
typeID: { type: MBID }
|
typeID: { type: MBID }
|
||||||
|
|
@ -141,7 +124,7 @@ export const relations = {
|
||||||
if (source.relations != null) {
|
if (source.relations != null) {
|
||||||
return source.relations
|
return source.relations
|
||||||
}
|
}
|
||||||
const entityType = dashify(info.parentType.name)
|
const entityType = toEntityType(info.parentType.name)
|
||||||
const id = source.id
|
const id = source.id
|
||||||
const params = includeRelations({}, info)
|
const params = includeRelations({}, info)
|
||||||
return lookupLoader.load([entityType, id, params]).then(entity => {
|
return lookupLoader.load([entityType, id, params]).then(entity => {
|
||||||
|
|
@ -166,80 +149,22 @@ export const artistCredit = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const artists = {
|
export const artists = linkedQuery(ArtistConnection)
|
||||||
type: new GraphQLList(Artist),
|
export const events = linkedQuery(EventConnection)
|
||||||
args: {
|
export const labels = linkedQuery(LabelConnection)
|
||||||
limit: { type: GraphQLInt },
|
export const places = linkedQuery(PlaceConnection)
|
||||||
offset: { type: GraphQLInt }
|
export const recordings = linkedQuery(RecordingConnection)
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const events = {
|
export const releases = linkedQuery(ReleaseConnection, {
|
||||||
type: new GraphQLList(Event),
|
type: { type: ReleaseGroupType },
|
||||||
args: {
|
types: { type: new GraphQLList(ReleaseGroupType) },
|
||||||
limit: { type: GraphQLInt },
|
status: { type: ReleaseStatus },
|
||||||
offset: { type: GraphQLInt }
|
statuses: { type: new GraphQLList(ReleaseStatus) }
|
||||||
},
|
})
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const labels = {
|
export const releaseGroups = linkedQuery(ReleaseGroupConnection, {
|
||||||
type: new GraphQLList(Label),
|
type: { type: ReleaseGroupType },
|
||||||
args: {
|
types: { type: new GraphQLList(ReleaseGroupType) }
|
||||||
limit: { type: GraphQLInt },
|
})
|
||||||
offset: { type: GraphQLInt }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const places = {
|
export const works = linkedQuery(WorkConnection)
|
||||||
type: new GraphQLList(Place),
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const recordings = {
|
|
||||||
type: new GraphQLList(Recording),
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const releases = {
|
|
||||||
type: new GraphQLList(Release),
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
type: { type: ReleaseGroupType },
|
|
||||||
types: { type: new GraphQLList(ReleaseGroupType) },
|
|
||||||
status: { type: ReleaseStatus },
|
|
||||||
statuses: { type: new GraphQLList(ReleaseStatus) }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const releaseGroups = {
|
|
||||||
type: new GraphQLList(ReleaseGroup),
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt },
|
|
||||||
type: { type: ReleaseGroupType },
|
|
||||||
types: { type: new GraphQLList(ReleaseGroupType) }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const works = {
|
|
||||||
type: new GraphQLList(Work),
|
|
||||||
args: {
|
|
||||||
limit: { type: GraphQLInt },
|
|
||||||
offset: { type: GraphQLInt }
|
|
||||||
},
|
|
||||||
resolve: linkedResolver()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue