I am trying to enable multi-owner access for my @model type in AppSync. Below is the model
type Salary
@model
@auth(
rules: [
{ allow: owner }
{ allow: owner, ownerField: "read_only_owners", operations: [read] }
{
allow: owner
ownerField: "read_write_owners"
operations: [create, read, update, delete]
}
{ allow: public, provider: iam }
]
) {
wage: Int
currency: currencyEnum
read_only_owners: [String]
read_write_owners: [String]
}
It works fine in theory. But the issue is, if the client wants to add a new owner, all entries in the database with read_only_owners or read_write_owners need to be updated. This is certainly not ideal when you have thousands of records and you want the client to be able to add or remove owners in an efficient manner.
Is there a better way of achieving multi-owner access to a record ?