Skip to content

Instantly share code, notes, and snippets.

@Wonder2210
Last active May 29, 2020 04:38
Show Gist options
  • Save Wonder2210/76200ff85da74ff0ba1ea574dce3c248 to your computer and use it in GitHub Desktop.
Save Wonder2210/76200ff85da74ff0ba1ea574dce3c248 to your computer and use it in GitHub Desktop.
Basic Graphql schema
enum Species{
BIRDS,
FISH,
MAMMALS,
REPTILES
}
type User {
id: Int!
full_name: String
country_code: String
created_at:String
pets:[Pet]
}
type Pet {
id: Int!
name: String
owner_id: Int!
specie: Species
created_at:String
owner:User
}
input createUserInput{
full_name: String!
country_code: String!
}
input createPetInput{
name: String!
owner_id: Int!
specie: Species!
}
input updateUserInput{
id:Int!
full_name: String
country_code: String
}
input updatePetInput{
id:Int!
name: String!
}
type Query{
pets:[Pet]
users:[User]
user(id:Int!):User
pet(id:Int!):Pet
}
type Mutation{
createPet(pet:createPetInput!):Pet
createUser(user:createUserInput!):User
deletePet(id:Int!):String
deleteUser(id:Int!):String
updatePet(pet:updatePetInput!):Pet
updateUser(user:updateUserInput!):User
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment