graphbrainz/src/types/artist-credit.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-08-08 07:54:06 +00:00
import { GraphQLObjectType, GraphQLString } from 'graphql/type'
2016-08-20 05:59:32 +00:00
import Artist from './artist'
2016-08-08 07:54:06 +00:00
export default new GraphQLObjectType({
name: 'ArtistCredit',
2016-11-26 01:38:32 +00:00
description: `[Artist credits](https://musicbrainz.org/doc/Artist_Credits)
indicate who is the main credited artist (or artists) for releases, release
groups, tracks and recordings, and how they are credited. They consist of
artists, with (optionally) their names as credited in the specific release,
track, etc., and join phrases between them.`,
2016-08-08 07:54:06 +00:00
fields: () => ({
2016-08-20 05:59:32 +00:00
artist: {
type: Artist,
2016-11-26 01:38:32 +00:00
description: `The entity representing the artist referenced in the
credits.`,
2016-08-20 05:59:32 +00:00
resolve: (source) => {
const { artist } = source
2016-11-26 01:38:32 +00:00
if (artist) {
artist._type = 'artist'
2016-11-26 01:38:32 +00:00
}
2016-08-20 05:59:32 +00:00
return artist
}
},
2016-11-26 01:38:32 +00:00
name: {
type: GraphQLString,
description: `The name of the artist as credited in the specific release,
track, etc.`
},
joinPhrase: {
type: GraphQLString,
description: `Join phrases might include words and/or punctuation to
separate artist names as they appear on the release, track, etc.`,
resolve: data => data['joinphrase']
}
2016-08-08 07:54:06 +00:00
})
})