mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
24 lines
738 B
JavaScript
24 lines
738 B
JavaScript
import {
|
|
GraphQLObjectType,
|
|
GraphQLNonNull,
|
|
GraphQLInt
|
|
} from 'graphql/type'
|
|
|
|
export default new GraphQLObjectType({
|
|
name: 'Rating',
|
|
description: `[Ratings](https://musicbrainz.org/doc/Rating_System) allow users
|
|
to rate MusicBrainz entities. User may assign a value between 1 and 5; these
|
|
values are then aggregated by the server to compute an average community rating
|
|
for the entity.`,
|
|
fields: () => ({
|
|
voteCount: {
|
|
type: new GraphQLNonNull(GraphQLInt),
|
|
description: 'The number of votes that have contributed to the rating.',
|
|
resolve: rating => rating['votes-count']
|
|
},
|
|
value: {
|
|
type: GraphQLInt,
|
|
description: 'The average rating value based on the aggregated votes.'
|
|
}
|
|
})
|
|
})
|