Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
GraphQL result for another mutation

Is it meanwhile possible to use the result of a GraphQL mutation as a parameter for another mutation?

I would like to create a user and his address together in one call.

First I write the address and then take the address id for the creation of the user. Filling the necessary data via the inputs works perfectly

Is this possible without triggering a new mutation from the client?

const createUser = gql`
  mutation createUser(
    $user: createUserInput!
    $address: createAddressInput!
  ) {
    createAddress(input: $address) {
      address {
        id       
      }
    }
    createUser(input: $user ) {
      user {
        id
        username
      }
    }
  }
`
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

No, this is not possible. You either have to make two sequential requests from the client, or adapt your server implementation. I recommend the latter.

You should change your schema so that the CreateUserInput type to not only accepts an addressId: ID but alternatively can accept a newAddress: CreateAddressInput object, which it will then use to create a new address before creating a new user.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda