Toi
04/26/2023, 9:29 PMdefinition role {
relation member: user
}
I have an use case in which I receive a list of users and update a given role members to be exactly that list. I have a couple questions about how to do that:
1- What is the appropriate way to update those relationships? Right now I'm deleting all member relationships of that role, and recreating them from scratch with the new user list.
2- A user may only be member of a single role at a time. How would you delete their previous memberships before creating the new one? Should I iterate over each user and delete their current membership one at a time, or is there an easier way of doing this? I'm afraid deleting one at a time might create inconsistencies (in case a delete fails).