So an invoice has a couple relations, being 1:many...
# prisma-whats-new
a
So an invoice has a couple relations, being 1:many with items/pads ... 1:1 with customer and salesperson. How do I structure a mutation to be able to create a complete Invoice with the fields I've made across all the types?
n
@akadop for the related nodes, you have to come up with a workflow to handle connecting to an existing nodes vs. creating and connecting to a new node. for example, you add a new invoice to the list of invoices for an existing salesperson vs creating the first invoice for a new salesperson. I'm not familiar with all the types in your schema, can you help me out with that? For example I can't say if you always want to create new items for an invoice, or if you just want to connect to existing items.
a
@nilan Thanks for the reply. All of these will be new entries, I don't have any set items for now as the number of possibilities is infinite at a flooring company (the project is a learning experience that might help out a friend who spends a lot of time doing physical order forms rather than throwing it on an ipad in store) Is graphql not appropriate for this kind of thing? Or should I throw all the fields under one type?
n
If all related nodes will be new, then the mutation is fairly straight forward. You can refer to the syntax of so called "nested create mutations" here: https://www.graph.cool/docs/reference/simple-api/nested-create-mutations-vaet3eengo/
Hope that helps 🙂
a
Thanks a ton.