Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. A simple `types.gql` to define basic content types...
  2. ```graphql
  3. type Post @options("where", "limit", "order") {
  4. title: String!
  5. content: String
  6. }
  7. ```
  8.  
  9. The resulting schema...
  10. ```graphql
  11. type Post {
  12. id: ID!
  13. title: String!
  14. content: String
  15. }
  16.  
  17. type Posts {
  18. posts: [Post],
  19. count: Int
  20. }
  21.  
  22. input postInput {
  23. title: String!
  24. content: String
  25. }
  26.  
  27. type Query {
  28. post(id: ID!): Post
  29. posts(where: {}, order: {}, limit: {}): Posts
  30. }
  31.  
  32. type Mutation {
  33. createPost(post: postInput): Post
  34. deletePost(postId: ID!): Post
  35. updatePost(postId: ID!, postInput): Post
  36. }
  37. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement