Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const SingerType = new GraphQLObjectType({
- name: "Singer",
- description: "A band´s singer",
- fields: () => ({
- id: {
- type: new GraphQLNonNull(GraphQLID),
- },
- name: {
- type: new GraphQLNonNull(GraphQLString)
- },
- band: {
- type: new GraphQLNonNull(BandType),
- resolve: (source, args, context) => {
- return Band.findOne({
- _id: source.band_id
- }).exec();
- }
- }
- albuns: {
- type: new GraphQLList(AlbumType),
- resolve: (source, args, context) => {
- return Album.find({
- _id: source._id
- }).exec();
- }
- }
- })
- });
- export const SingerInputType = new GraphQLInputObjectType({
- name: "SingerInput",
- description: "Band´s singer input type",
- fields: () => ({
- name: {
- type: new GraphQLNonNull(GraphQLString)
- },
- band_id: {
- type: new GraphQLNonNull(GraphQLString) <<== GraphQLString or GraphQLID here ???
- },
- albuns: {
- type: new GraphQLList(GraphQLString) <<== GraphQLString or GraphQLID here ???
- } }
- })
- });
Add Comment
Please, Sign In to add comment