This is my mutation, I know the mutation works bec...
# prisma-whats-new
a
This is my mutation, I know the mutation works because when I throw in variables in the playground it goes through successfully
n
@akadop what technologies are you using? 🙂
a
I'm using React and Apollo. Thanks for the example. While this does help, how do I go about doing this with a nested mutation that contains both one:one and one:many relationships?
n
you need to inject an object for the
to-one
variables and an array of objects fot the
to-many
variables 🙂
a
Sorry if I sound like a total idiot, but inject an object?
Thanks for the help so far, gotta go to bed but I hope to have this working by tomorrow night 😕
n
😄 This may be my limited english haha
You correctly declared this variable:
$customer: InvoicecustomerCustomer
now, when calling the mutation, you need to pass in a variable called
customer
which is an object
this.props.mutate({variables: {customer: {name: "Nilan"}}})
$items: [InvoiceitemsItem!]
is a list of objects, so this results in
Copy code
const customer = {name: "Nilan"}
const items = [{name: "A"}, {name: "B"}]

this.props.mutate({variables: {customer, items}})
a
Thanks for your help
For everything so far
🙌 1
static PropTypes = { addInvoice: React.PropTypes.func.isRequired, items: React.PropTypes.object.isRequired, pads: React.PropTypes.object.isRequired, payment: React.PropTypes.object.isRequired, scheduleDate: React.PropTypes.any, storeName: React.PropTypes.string, installer: React.PropTypes.string, }
going in the right direction?
n
I don't know what you want to do 🙂
can you describe what you want do to?
a
I want to make a Form. For someone to be able to add their own items, pads, etc into the form and finally submit all of it as a new invoice to graph.cool