Use information of a previous GraphQL mutation in the same query

161 views Asked by At

I want to run a single query with multiple mutations, but I need to reference the data from a previous mutations is that possible?

mutation {
  venue1: createVenue(data: { name: "Test Venue 1", active: true }) {
    id
  }
  layout1: createLayout(
    data: { name: "Test Layout 1", active: true, venue: { connect: (I WANT TO USE venue1) } }
  ) {
    id
  }
}

This is a over-simplification of what I'm trying to do, I'll need to use a single query to seed a DB for testing purposes, and using create instead of connect won't be enough because there are required relations and elements which require multiple relations, so it need to be lineal to fill all of those relations.

0

There are 0 answers