linagora / tmail-backend

GNU Affero General Public License v3.0
30 stars 17 forks source link

[PublicAsset] Implement updateIdentityIds method for PublicAssetRepository #1073

Open vttranlina opened 1 month ago

vttranlina commented 1 month ago

It can help us update partial identities without resetting them. The method was introduced at pr https://github.com/linagora/tmail-backend/pull/1063

with default impl:

  def updateIdentityIds(username: Username, id: PublicAssetId, identityIdsToAdd: Seq[IdentityId], identityIdsToRemove: Seq[IdentityId]): Publisher[Void] =
    SMono(get(username, id))
      .map(publicAsset => (publicAsset.identityIds.toSet ++ identityIdsToAdd.toSet) -- identityIdsToRemove.toSet)
      .flatMap(identityIds => SMono(update(username, id, identityIds)))

We can override it for Cassandra, PostgreSQL impl?

Arsnael commented 1 month ago

Is it necessary to override this for cassandra and postgres? I dont feel like it is somehow

chibenwa commented 1 month ago

In the cassandra app we can leverage Caddandra indempotence by using a non frozen set

chibenwa commented 1 month ago

(so without read-patch-reset logic)