diff --git a/modules/backend/src/main/scala/sharry/backend/alias/OAlias.scala b/modules/backend/src/main/scala/sharry/backend/alias/OAlias.scala index 044754de..a6d7ee3e 100644 --- a/modules/backend/src/main/scala/sharry/backend/alias/OAlias.scala +++ b/modules/backend/src/main/scala/sharry/backend/alias/OAlias.scala @@ -64,10 +64,11 @@ object OAlias { detail: AliasInput ): F[AddResult] = { val doUpdate = for { + _ <- RAliasMember.deleteForAlias(aliasId) n <- RAlias.update(aliasId, accId, detail.alias) k <- - if (n > 0) RAliasMember.updateForAlias(aliasId, detail.members) - else 0.pure[ConnectionIO] + if (n > 0) RAliasMember.insertForAlias(detail.alias.id, detail.members) + else RAliasMember.insertForAlias(aliasId, detail.members) } yield n + k for {