Hi guys, sorry for the inconvenience, I'm new with...
# prisma-whats-new
d
Hi guys, sorry for the inconvenience, I'm new with Prisma and GraphQL and the state that has problems to make mutations with relationships. He tried to raise a simple API that has questions and answers. The answers are linked to the questions. Although I could do that in the datamodel.graphql, no example was found to perform the mutation to add a new answer related to a question.
k
Check
addProductToOrder
mutation here https://github.com/KATT/shop/blob/master/api/src/schema.graphql#L24-L28 https://github.com/KATT/shop/blob/master/api/src/resolvers/Mutation/order.ts#L21-L93 Resolvers finds order based on id, checks if there’s an order row with the same product in it and either creates a row or ups quantity
❤️ 1
d
Ok! thanks a lot katt, I try to read and implement it
🌟 1
Sory, is a many to many relationship right ? How look's a one to many relationship mutation ?
k
nah it’s a 1:M
Order is a “Shopping cart”
You can see it in action here shop.kattcorp.co.uk
💯 1
d
Oh really thanks katt ! I'm new on this and doesn't have much real examples with prisma.
k
My idea is to make that repo into a ref project for a lot of things
d
Well, If in the future I can collaborate with your repo, it would be great !
k