Created
August 10, 2021 16:26
-
-
Save IanPhilips/c8198357491c7ef618325b97d4fffd42 to your computer and use it in GitHub Desktop.
graphql schema
This file contains 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
type Product @model { | |
id: ID! | |
name: String! | |
priceID:String! | |
serviceAreas: [ProductOffering] @connection(keyName: "byServiceArea", fields: ["id"]) | |
} | |
# Create a join model and disable queries as you don't need them | |
# and can query through Post.editors and User.posts | |
type ProductOffering | |
@model(queries: null) | |
@key(name: "byServiceArea", fields: ["serviceAreaID", "productID"]) | |
@key(name: "byProduct", fields: ["productID", "serviceAreaID"]) { | |
id: ID! | |
productID: ID! | |
serviceAreaID: ID! | |
product: Product! @connection(fields: ["productID"]) | |
serviceArea: ServiceArea! @connection(fields: ["serviceAreaID"]) | |
} | |
type ServiceArea @model { | |
id: ID! | |
name: String! | |
products: [ProductOffering] @connection(keyName: "byProduct", fields: ["id"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment