Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: OrderToProduct #10

Open
Austin2Shih opened this issue Feb 23, 2024 · 0 comments
Open

API: OrderToProduct #10

Austin2Shih opened this issue Feb 23, 2024 · 0 comments
Assignees

Comments

@Austin2Shih
Copy link
Contributor

Austin2Shih commented Feb 23, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants