Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const AlbumType = new GraphQLObjectType({
- name: "Album",
- fields: {
- id: {
- type: new GraphQLNonNull(GraphQLInt),
- description: "The id of the Album."
- },
- name: {
- type: new GraphQLNonNull(GraphQLString),
- description: "The name of the Album."
- },
- year: {
- type: GraphQLString,
- description: "The year of the Album."
- },
- artist_id: {
- type: GraphQLInt,
- description: "The artist_id of the Album."
- },
- artist: {
- type: ArtistType,
- resolve: (parent) => parent.getArtist()
- }
- }
- })
- const ArtistType = new GraphQLObjectType({
- name: "Artist",
- fields: {
- id: {
- type: new GraphQLNonNull(GraphQLInt),
- description: "The id of the Artist."
- },
- name: {
- type: new GraphQLNonNull(GraphQLString),
- description: "The name of the Artist."
- },
- url: {
- type: GraphQLString,
- description: "The url of the Artist."
- },
- albums: {
- type: new GraphQLList(AlbumType),
- resolve: (parent, args, context) => parent.getAlbums()
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement