Skip to content

Instantly share code, notes, and snippets.

@JeffML
Created August 21, 2017 01:25
Show Gist options
  • Save JeffML/0b27d6b93526946a2ef174894610b1e8 to your computer and use it in GitHub Desktop.
Save JeffML/0b27d6b93526946a2ef174894610b1e8 to your computer and use it in GitHub Desktop.
Refactoring authorposts schema
export default `
type Author {
id: Int!
firstName: String
lastName: String
posts: [Post] # the list of Posts by this author
}`
export default `
type Post {
id: Int!
title: String
author: Author
votes: Int
}`
import Author from './components/author'
import Post from './components/post'
const typeDefs =
`
# the schema allows the following query:
extend type Query {
posts: [Post]
author(id: Int!): Author
}
# this schema allows the following mutation:
extend type Mutation {
upvotePost (
postId: Int!
): Post
}
`;
export default [typeDefs, Author, Post];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment