2016-11-26 01:38:32 +00:00
|
|
|
|
import { GraphQLObjectType, GraphQLList } from 'graphql/type'
|
2016-08-31 06:33:29 +00:00
|
|
|
|
import Node from './node'
|
2016-08-20 05:59:32 +00:00
|
|
|
|
import Entity from './entity'
|
|
|
|
|
|
import { DateType } from './scalars'
|
2016-11-26 01:38:32 +00:00
|
|
|
|
import { ReleaseGroupType } from './enums'
|
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
|
|
|
|
title,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artistCredit,
|
2016-12-11 20:32:58 +00:00
|
|
|
|
artistCredits,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artists,
|
|
|
|
|
|
releases,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags,
|
|
|
|
|
|
fieldWithID,
|
2016-12-02 08:21:10 +00:00
|
|
|
|
resolveHyphenated,
|
2016-11-28 14:43:32 +00:00
|
|
|
|
connectionWithExtras
|
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 ReleaseGroup = new GraphQLObjectType({
|
2016-08-08 07:54:06 +00:00
|
|
|
|
name: 'ReleaseGroup',
|
2016-11-26 01:38:32 +00:00
|
|
|
|
description: `A [release group](https://musicbrainz.org/doc/Release_Group) is
|
|
|
|
|
|
used to group several different releases into a single logical entity. Every
|
|
|
|
|
|
release belongs to one, and only one release group.
|
|
|
|
|
|
|
|
|
|
|
|
Both release groups and releases are “albums” in a general sense, but with an
|
|
|
|
|
|
important difference: a release is something you can buy as media such as a CD
|
|
|
|
|
|
or a vinyl record, while a release group embraces the overall concept of an
|
|
|
|
|
|
album – it doesn’t matter how many CDs or editions/versions it had.`,
|
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
|
|
|
|
title,
|
|
|
|
|
|
disambiguation,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
aliases,
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artistCredit,
|
2016-12-11 20:32:58 +00:00
|
|
|
|
artistCredits,
|
2016-11-26 01:38:32 +00:00
|
|
|
|
firstReleaseDate: {
|
|
|
|
|
|
type: DateType,
|
|
|
|
|
|
description: 'The date of the earliest release in the group.',
|
2016-12-02 08:21:10 +00:00
|
|
|
|
resolve: resolveHyphenated
|
2016-11-26 01:38:32 +00:00
|
|
|
|
},
|
|
|
|
|
|
...fieldWithID('primaryType', {
|
|
|
|
|
|
type: ReleaseGroupType,
|
|
|
|
|
|
description: `The [type](https://musicbrainz.org/doc/Release_Group/Type)
|
|
|
|
|
|
of a release group describes what kind of releases the release group represents,
|
|
|
|
|
|
e.g. album, single, soundtrack, compilation, etc. A release group can have a
|
|
|
|
|
|
“main” type and an unspecified number of additional types.`
|
|
|
|
|
|
}),
|
|
|
|
|
|
...fieldWithID('secondaryTypes', {
|
|
|
|
|
|
type: new GraphQLList(ReleaseGroupType),
|
|
|
|
|
|
description: `Additional [types](https://musicbrainz.org/doc/Release_Group/Type)
|
|
|
|
|
|
that apply to this release group.`
|
|
|
|
|
|
}),
|
2016-08-20 05:59:32 +00:00
|
|
|
|
artists,
|
|
|
|
|
|
releases,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
relationships,
|
2016-12-12 08:34:26 +00:00
|
|
|
|
collections,
|
2016-11-28 13:49:04 +00:00
|
|
|
|
tags
|
2016-08-08 07:54:06 +00:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2016-08-20 05:59:32 +00:00
|
|
|
|
|
2016-11-28 14:43:32 +00:00
|
|
|
|
export const ReleaseGroupConnection = connectionWithExtras(ReleaseGroup)
|
2016-08-20 05:59:32 +00:00
|
|
|
|
export default ReleaseGroup
|