Skip to content

Instantly share code, notes, and snippets.

@meshboy
Last active December 3, 2018 03:19
Show Gist options
  • Select an option

  • Save meshboy/56366c24d8b293fe996b49dea216b3de to your computer and use it in GitHub Desktop.

Select an option

Save meshboy/56366c24d8b293fe996b49dea216b3de to your computer and use it in GitHub Desktop.
type Recipe {
id: ID!
name: String!
description: String!
difficultyLevel: Int!
image: String
steps: [String]!
averageTimeForCompletion: Int!
user: User!
}
input NewRecipe {
name: String!
description: String!
difficultyLevel: Int!
image: Upload
steps: [String]!
averageTimeForCompletion: Int!
}
input UpdateRecipe {
id: ID!
name: String
description: String
difficultyLevel: Int!
image: String
steps: [String]
averageTimeForCompletion: Int!
}
input DeleteRecipe {
id: ID!
}
# query is use when you want to get anything from
#the server just like (GET) using REST
extend type Query {
Recipe(id: ID!): Recipe!
Recipes: [Recipe]!
}
# performing actions (that requires DELETE, PUT, POST)
#just as in REST requires a mutation
extend type Mutation {
deleteRecipe(input: DeleteRecipe!): Recipe!
updateRecipe(input: UpdateRecipe!): Recipe!
newRecipe(input: NewRecipe!): Recipe!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment