include-davis / Include-Estore-API

MIT License
0 stars 0 forks source link

API: OrderToProduct #10

Open Austin2Shih opened 4 months ago

Austin2Shih commented 4 months ago

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