Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to update multiple #262

Open
RyanLackie opened this issue May 24, 2024 · 0 comments
Open

Option to update multiple #262

RyanLackie opened this issue May 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@RyanLackie
Copy link

RyanLackie commented May 24, 2024

Is your feature request related to a problem? Please describe.
Hey 👋

@TriPSs I saw your feature request in the original project by Doug Martin.

This is a similar situation I am running into where ideally I would send a single mutation request to update multiple records with their own values.
The same structure could be used to update a parent object along with multiple (one to many) related children too, each with their own values.

This is similar to what mutations Hasura supports.

Is this something you think nestjs-query would eventually support? I'm not familiar with what changes would be needed to support this functionality but I imagine it could be a large undertaking.

Have you read the Contributing Guidelines?

Yes

Describe the solution you'd like
Along with the normal update many mutation:

mutation {
  updateManyTodoItems(
    input: { filter: { id: { in: [1, 2] } }, update: { completed: true } }
  ) {
    updatedCount
  }
}

Also being able to process inputs that look like:

mutation {
  updateManyTodoItems(
    input: [
        { id: 1, update: { completed: true },
        { filter: { id: { in: [2, 3] } }, update: { completed: false }
    ]
  ) {
    updatedCount
  }
}

and

mutation {
  updateOneTodoItem(
    input: {
        id: 1,
        update: {
            childTodoItems: {
                input: [
                   { id: 1, update: { completed: true },
                   { filter: { id: { in: [2, 3] } }, update: { completed: false }
                ]
            }
        }
    }
  ) {
    updatedCount
  }
}

Describe alternatives you've considered
Alternatively the client could orchestrate these requests which isn't that bad of a problem, however allowing this tool to take on that responsibility would massively reduce the code and complexity the client would need to handle.

@RyanLackie RyanLackie added the enhancement New feature or request label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant