From d8d376386d9fc39ccdc03e888ffc8b8ad16909bc Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 1 Oct 2025 16:37:23 +0700 Subject: [PATCH] fix --- src/controllers/OrganizationController.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index 068170f6..c12b1a72 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -8041,17 +8041,21 @@ export class OrganizationController extends Controller { }); let check: number = 0; + let notDelete: string[] = []; await Promise.all( profileLeave.map(async (profile) => { profile.leaveReason = "เกษียณอายุราชการ"; profile.isActive = false; - if (profile.keycloak != null) { + if (profile.keycloak != null && profile.keycloak != "") { const delUserKeycloak = await deleteUser(profile.keycloak); if (delUserKeycloak) { profile.keycloak = ""; profile.roleKeycloaks = []; check += 1; + } else { + // push array not delete + notDelete.push(profile.keycloak); } } @@ -8061,6 +8065,6 @@ export class OrganizationController extends Controller { // จำนวนคนที่ถูกแก้ไขเหตุผลการลาออก const total = profileLeave.length; - return new HttpSuccess({ total, successAmount: check }); + return new HttpSuccess({ total, successAmount: check, notDelete }); } }