Created
May 2, 2020 10:36
-
-
Save a7v8x/80cb0730f6467011f8693d26a901f925 to your computer and use it in GitHub Desktop.
User Object Class https://atheros.ai/blog/input-object-type-as-an-argument-for-graphql-mutations-and-queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
GraphQLString, | |
GraphQLID, | |
GraphQLObjectType, | |
GraphQLNonNull, | |
} from 'graphql'; | |
const User = new GraphQLObjectType({ | |
name: 'User', | |
description: 'User type definition', | |
fields: () => ({ | |
id: { | |
type: new GraphQLNonNull(GraphQLID), | |
}, | |
username: { | |
type: new GraphQLNonNull(GraphQLString), | |
}, | |
email: { | |
type: GraphQLString, | |
}, | |
phone: { | |
type: GraphQLString, | |
}, | |
firstName: { | |
type: GraphQLString, | |
}, | |
lastName: { | |
type: GraphQLString, | |
}, | |
}), | |
}); | |
export default User; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment