Guest User

Untitled

a guest
Dec 27th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. import { GraphQLBoolean, GraphQLID, GraphQLInputObjectType, GraphQLInt, GraphQLNonNull, GraphQLObjectType, GraphQLString } from "graphql";
  2.  
  3. // User type
  4. const userType = new GraphQLObjectType({
  5. name: "User",
  6. fields: {
  7. id: { type: GraphQLID },
  8. username: { type: GraphQLString },
  9. name: { type: GraphQLString },
  10. password: { type: GraphQLString },
  11. token: { type: GraphQLString },
  12. createdAt: { type: GraphQLString },
  13. updatedAt: { type: GraphQLString },
  14. },
  15. });
  16.  
  17. // Data reponse of user
  18. const DataResponse = new GraphQLObjectType({
  19. name: "DataResponse",
  20. fields: {
  21. success: { type: GraphQLBoolean },
  22. user: { type: userType },
  23. token: { type: GraphQLString },
  24. },
  25. });
  26.  
  27. // Response from User
  28. const responseType = new GraphQLObjectType({
  29. name: "Response",
  30. fields: {
  31. code: { type: new GraphQLNonNull(GraphQLInt) },
  32. message: { type: new GraphQLNonNull(GraphQLString) },
  33. data: { type: new GraphQLNonNull(DataResponse) },
  34. },
  35. });
  36.  
  37. // User input is getting input from user
  38. const UserInput = new GraphQLInputObjectType({
  39. name: "UserInputRegister",
  40. fields: {
  41. username: { type: GraphQLString },
  42. name: { type: GraphQLString },
  43. password: { type: GraphQLString },
  44. },
  45. });
  46.  
  47. export const userRegisterSchema = {
  48. userType,
  49. DataResponse,
  50. responseType,
  51. UserInput,
  52. };
Add Comment
Please, Sign In to add comment