typescript – GraphQL: Nested update mutations

I am building my GraphQL API using Nest and Prisma.

Im wondering whats the best way to update records in my api.

Lets say i have two models of Customer and Vehicles, in which Customer can own range of Vehicles.

I see 2 options here:

To update vehicles through Customer using him as a context in Customer Service

mutation updateCustomer{
  updateCustomer {
    Vehicles {
    }
  }
}

or to update vehicles directly in Vehicle Service

mutation updateVehicles {
  updateVehicles {
  }
}

Which is better approach?

Read more here: Source link