Skip to content

Instantly share code, notes, and snippets.

@chickencoder
Last active August 7, 2019 19:52
Show Gist options
  • Save chickencoder/e02950a987aa4a226da1c3c512b330f0 to your computer and use it in GitHub Desktop.
Save chickencoder/e02950a987aa4a226da1c3c512b330f0 to your computer and use it in GitHub Desktop.

A simple types.gql to define basic content types...

type Post @options("where", "limit", "order") {
  title: String!
  content: String
}

The resulting schema...

type Post {
  id: ID!
  title: String!
  content: String
}

type Posts {
  posts: [Post],
  count: Int
}

input postInput {
  title: String!
  content: String
}

type Query {
  post(id: ID!): Post
  posts(where: {}, order: {}, limit: {}): Posts
}

type Mutation {
  createPost(post: postInput): Post
  deletePost(postId: ID!): Post
  updatePost(postId: ID!, postInput): Post
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment