Guest User

Untitled

a guest
Sep 11th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. const { gql } = require('apollo-server-koa')
  2. const UserType = require('./types/user')
  3. const PostType = require('./types/post')
  4.  
  5. const RootQuery = gql`
  6. type Query {
  7. getUser(id: Int!): User
  8. getPostsByUserId(user_id: Int!): [Post!]
  9. }
  10. `;
  11.  
  12. const RootMutation = `
  13. type Mutation {
  14. addUser(username: String!, password: String!, fullName: String, email: String, phone: String): User
  15. addPost(user_id: Int!, title: String!, content: String!): Post
  16. updatePost(id: Int!, title: String, content: String): Post
  17. }
  18. `;
  19.  
  20. const SchemaDefinition = `
  21. schema {
  22. query: Query
  23. mutation: Mutation
  24. }
  25. `;
  26.  
  27. module.exports = [
  28. SchemaDefinition, RootQuery, RootMutation, UserType, PostType
  29. ];
Add Comment
Please, Sign In to add comment