Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const {
- GraphQLObjectType,
- GraphQLString,
- GraphQLNonNull,
- GraphQLBoolean,
- } = require('graphql');
- const { UserType } = require('./user');
- const AuthenticationMutations = {
- registerUser: {
- type: UserType,
- args: {
- username: {
- type: new GraphQLNonNull(GraphQLString)
- },
- email: {
- type: new GraphQLNonNull(GraphQLString)
- },
- password: {
- type: new GraphQLNonNull(GraphQLString)
- },
- name: {
- type: GraphQLString
- }
- },
- async resolve(_, args, { db }) {
- try {
- const user = await db.user.create(args);
- return user;
- } catch (error) {
- throw new Error(error);
- }
- }
- }
- };
- module.exports = {
- AuthenticationMutations
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement