I have a products.sdl.ts
with the following:
type Product {
id: String!
title: String!
categories: [CategoriesOnProduct]!
}
type Query {
products: [Product!]! @requireAuth
product(id: String!): Product @requireAuth
}
input CreateProductInput {
title: String!
}
input UpdateProductInput {
title: String
}
type Mutation {
createProduct(input: CreateProductInput!): Product! @requireAuth
updateProduct(id: String!, input: UpdateProductInput!): Product!
@requireAuth
deleteProduct(id: String!): Product! @requireAuth
}
I would like to update the categories
when updating a Product, but I’m new to GraphQL and can’t seem to grasp how to do that. I tried to add it to the UpdateProductInput
but it says it cannot recognize the CategoriesOnProduct
.
Does anyone have an example I can refer to?