fix keycloak user & update isDelete
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m1s

This commit is contained in:
Warunee Tamkoo 2026-04-02 16:32:29 +07:00
parent 212360a764
commit fb4196cfa2
9 changed files with 445 additions and 354 deletions

View file

@ -1653,12 +1653,13 @@ export class CommandController extends Controller {
_profile.leaveDate = _Date;
_profile.dateLeave = _Date;
_profile.lastUpdatedAt = _Date;
if (_profile.keycloak != null && _profile.keycloak != "") {
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
// console.log("4. disable keycloak/authen")
const delUserKeycloak = await deleteUser(_profile.keycloak, adminToken);
if (delUserKeycloak) {
// Task #228
// _profile.keycloak = "";
_profile.isDelete = true;
_profile.roleKeycloaks = [];
}
}
@ -1710,12 +1711,13 @@ export class CommandController extends Controller {
_profileEmp.leaveDate = _Date;
_profileEmp.dateLeave = _Date;
_profileEmp.lastUpdatedAt = _Date;
if (_profileEmp.keycloak != null && _profileEmp.keycloak != "") {
if (_profileEmp.keycloak != null && _profileEmp.keycloak != "" && _profileEmp.isDelete === false) {
// disable keycloak/authen
const delUserKeycloak = await deleteUser(_profileEmp.keycloak, adminToken);
if (delUserKeycloak) {
// Task #228
// _profileEmp.keycloak = "";
_profileEmp.isDelete = true;
_profileEmp.roleKeycloaks = [];
}
}
@ -4130,13 +4132,14 @@ export class CommandController extends Controller {
await removeProfileInOrganize(profile.id, "OFFICER");
}
if (clearProfile.status) {
if (profile.keycloak != null) {
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
const delUserKeycloak = await deleteUser(profile.keycloak);
if (delUserKeycloak) {
// Task #228
// profile.keycloak = _null;
profile.roleKeycloaks = [];
profile.isActive = false;
profile.isDelete = true;
}
}
profile.leaveCommandId = item.commandId ?? _null;
@ -4535,13 +4538,14 @@ export class CommandController extends Controller {
}
if (clearProfile.status) {
if (profile.keycloak != null) {
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
const delUserKeycloak = await deleteUser(profile.keycloak);
if (delUserKeycloak) {
// Task #228
// profile.keycloak = _null;
profile.roleKeycloaks = [];
profile.isActive = false;
profile.isDelete = true;
}
}
profile.leaveCommandId = item.commandId ?? _null;
@ -4756,13 +4760,14 @@ export class CommandController extends Controller {
const clearProfile = await checkCommandType(String(item.commandId));
const _null: any = null;
if (clearProfile.status) {
if (profile.keycloak != null) {
if (profile.keycloak != null && profile.keycloak != "" && profile.isDelete === false) {
const delUserKeycloak = await deleteUser(profile.keycloak);
if (delUserKeycloak) {
// Task #228
// profile.keycloak = _null;
profile.roleKeycloaks = [];
profile.isActive = false;
profile.isDelete = true;
}
}
profile.isLeave = item.isLeave;
@ -5253,13 +5258,14 @@ export class CommandController extends Controller {
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {
retireTypeName = clearProfile.retireTypeName ?? "";
if (_profile.keycloak != null) {
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) {
// Task #228
// _profile.keycloak = _null;
_profile.roleKeycloaks = [];
_profile.isActive = false;
_profile.isDelete = true;
}
}
_profile.leaveCommandId = item.commandId ?? _null;
@ -5437,13 +5443,14 @@ export class CommandController extends Controller {
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {
retireTypeName = clearProfile.retireTypeName ?? "";
if (_profile.keycloak != null) {
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) {
// Task #228
// _profile.keycloak = _null;
_profile.roleKeycloaks = [];
_profile.isActive = false;
_profile.isDelete = true;
}
}
_profile.leaveCommandId = item.commandId ?? _null;
@ -5776,13 +5783,14 @@ export class CommandController extends Controller {
}
const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile.status) {
if (_profile.keycloak != null) {
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) {
// Task #228
// _profile.keycloak = _null;
_profile.roleKeycloaks = [];
_profile.isActive = false;
_profile.isDelete = true;
}
}
_profile.leaveCommandId = item.commandId ?? _null;
@ -6214,13 +6222,14 @@ export class CommandController extends Controller {
const clearProfile = await checkCommandType(String(item.commandId));
const _null: any = null;
if (clearProfile.status) {
if (_profile.keycloak != null) {
if (_profile.keycloak != null && _profile.keycloak != "" && _profile.isDelete === false) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) {
// Task #228
// _profile.keycloak = _null;
_profile.roleKeycloaks = [];
_profile.isActive = false;
_profile.isDelete = true;
}
}
_profile.leaveCommandId = item.commandId ?? _null;