0

Would it be possible to create nested mutations on a GraphQL back-end? I have 3 tables in postgresql which are all related. I wanted to know if its possible to nest 3 separate mutations within a parent mutation (which will all do 3 separate INSERT statements.)

Is this possible? Or will I just have to create 3 separate mutations at the root level and nest them on the front-end with apollo-client ?

JohnSnow
  • 6,911
  • 8
  • 23
  • 44

1 Answers1

0

If this mutations won't be use in any other part of the code what you can do is to create one mutation and have the 3 insert statements inside, if your mutations are going to be needed in other part of the code I recommend separate them in 3 different mutations and handle them in the frontend, you can see an example here

Uziel Valdez
  • 2,040
  • 1
  • 15
  • 20