From c12bfa766ccec46d9e602b974d323af49b821de5 Mon Sep 17 00:00:00 2001 From: x032205 Date: Fri, 13 Jun 2025 14:51:39 -0400 Subject: [PATCH] Review fixes --- backend/src/lib/api-docs/constants.ts | 4 ++-- backend/src/services/identity/identity-service.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index 6c8d420e7..c0cbdfe8a 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -112,13 +112,13 @@ export const IDENTITIES = { name: "The name of the identity to create.", organizationId: "The organization ID to which the identity belongs.", role: "The role of the identity. Possible values are 'no-access', 'member', and 'admin'.", - hasDeleteProtection: "Whether the identity has delete protection or not." + hasDeleteProtection: "Prevents deletion of the identity when enabled." }, UPDATE: { identityId: "The ID of the identity to update.", name: "The new name of the identity.", role: "The new role of the identity.", - hasDeleteProtection: "Whether the identity now has delete protection or not." + hasDeleteProtection: "Prevents deletion of the identity when enabled." }, DELETE: { identityId: "The ID of the identity to delete." diff --git a/backend/src/services/identity/identity-service.ts b/backend/src/services/identity/identity-service.ts index c3651ceb7..cdd665498 100644 --- a/backend/src/services/identity/identity-service.ts +++ b/backend/src/services/identity/identity-service.ts @@ -191,9 +191,11 @@ export const identityServiceFactory = ({ } const identity = await identityDAL.transaction(async (tx) => { - const newIdentity = name - ? await identityDAL.updateById(id, { name, hasDeleteProtection }, tx) - : await identityDAL.findById(id, tx); + const newIdentity = + name || hasDeleteProtection + ? await identityDAL.updateById(id, { name, hasDeleteProtection }, tx) + : await identityDAL.findById(id, tx); + if (role) { await identityOrgMembershipDAL.updateById( identityOrgMembership.id,