diff --git a/server/schema/schema.js b/server/schema/schema.js index 15fa367..b8b8581 100644 --- a/server/schema/schema.js +++ b/server/schema/schema.js @@ -1,12 +1,12 @@ const { + GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLID, GraphQLInt, GraphQLList, - GraphQLSchema + GraphQLNonNull } = require('graphql'); -const _ = require('lodash'); const Book = require('../models/book'); const Author = require('../models/author'); @@ -79,8 +79,8 @@ const Mutation = new GraphQLObjectType({ addAuthor: { type: AuthorType, args: { - name: { type: GraphQLString }, - age: { type: GraphQLInt } + name: { type: new GraphQLNonNull(GraphQLString) }, + age: { type: new GraphQLNonNull(GraphQLInt) } }, resolve (parent, { name, age }) { const author = new Author({ @@ -93,9 +93,9 @@ const Mutation = new GraphQLObjectType({ addBook: { type: BookType, args: { - name: { type: GraphQLString }, - genre: { type: GraphQLString }, - authorId: { type: GraphQLID } + name: { type: new GraphQLNonNull(GraphQLString) }, + genre: { type: new GraphQLNonNull(GraphQLString) }, + authorId: { type: new GraphQLNonNull(GraphQLID) } }, resolve (parent, { name, genre, authorId }) { const book = new Book({