You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OrderToProduct is the join table for Orders and Products (many to many relationship)
This will have order_id, product_id, those together can make a unique key so you don't need an id field.
Make sure to also add in a field: quantity which will be used to determine how much of each Product is in the Order.
Edit the schema, resolvers, services for Order to support addProductToOrder mutation which takes in a quantity as an argument. If not specified then just default to quantity of 1.
Build out resolver for Order's products field which will return a list of ProductQuantity.
Define ProductQuantity type in the Order typedef file. Make sure the resolver for the products field returns data in the form of ProductQuantity list
The text was updated successfully, but these errors were encountered:
OrderToProduct is the join table for Orders and Products (many to many relationship)
This will have order_id, product_id, those together can make a unique key so you don't need an id field.
Make sure to also add in a field: quantity which will be used to determine how much of each Product is in the Order.
Edit the schema, resolvers, services for Order to support addProductToOrder mutation which takes in a quantity as an argument. If not specified then just default to quantity of 1.
Build out resolver for Order's products field which will return a list of ProductQuantity.
Define ProductQuantity type in the Order typedef file. Make sure the resolver for the products field returns data in the form of ProductQuantity list
The text was updated successfully, but these errors were encountered: