user
12/14/2021, 9:13 AMWriteRelationships
to create my users with something like that :
message WriteRelationships {
// Check that the user is not already linked to another project
optionalPreconditions: [{
optional_preconditions: MUST_NOT_MATCH
filter: {
resource_type: 'user'
optional_resource_id: 'user_id'
optional_subject_filter: {
subject_type: 'project'
}
}
}],
updates: [{
operation: 'CREATE'
relationship: {
subject: {
object: {
object_type: 'project'
object_id: 'project_id'
}
}
reference: {
object_type: 'user',
object_id: 'user_id'
}
}
}]
}
Until then everything works as expected, however if I delete the relation calling DeleteRelationships
:
message DeleteRelationshipsRequest {
relationship_filter: {
resource_type: 'user'
optional_resource_id: 'user_id'
}
}
I'm not able to re-call the same WriteRelationships request as the precondition fails.
Is it a normal behaviour ? Is there something I missing during the deletion ?