Last active
April 12, 2021 18:37
-
-
Save GeoffMahugu/be3e32bf73dfa5402e9cbe9d43eedad1 to your computer and use it in GitHub Desktop.
This is a schema file for a GraphQL application to perform CRUD operations on a Product.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { buildSchema } = require('graphql'); | |
export default buildSchema(` | |
type Product{ | |
_id:ID! | |
name: String! | |
description: StriWng! | |
price: Float! | |
discount: Int | |
created_at: String! | |
updated_at: String! | |
} | |
type ProductData { | |
products: [Product!]! | |
} | |
input ProductInputData { | |
name: String! | |
description: String! | |
price: Float! | |
discount: Int | |
} | |
type RootQuery { | |
products: ProductData! | |
} | |
type RootMutation { | |
createProduct(productInput:ProductInputData): Product! | |
updateProduct(id: ID!, productInput:ProductInputData): Product! | |
deleteProduct(id: ID!): Product! | |
} | |
schema { | |
query: RootQuery | |
mutation: RootMutation | |
} | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment