Fix #2343
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m17s

This commit is contained in:
harid 2026-02-26 17:53:59 +07:00
parent 9946b7b7c3
commit 79dbba2c89

View file

@ -6245,17 +6245,17 @@ export class CommandController extends Controller {
.orgRootShortName ?? "";
}
}
const before = null;
const meta = {
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
await Promise.all(
body.data.map(async (item) => {
const before = null;
const meta = {
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
const _null: any = null;
if (item.bodyProfile.posLevelId === "") item.bodyProfile.posLevelId = null;
if (item.bodyProfile.posTypeId === "") item.bodyProfile.posTypeId = null;
@ -6306,13 +6306,6 @@ export class CommandController extends Controller {
if (checkUser.length == 0) {
let password = item.bodyProfile.citizenId;
if (item.bodyProfile.birthDate != null) {
// const gregorianYear = item.bodyProfile.birthDate.getFullYear() + 543;
// const formattedDate =
// item.bodyProfile.birthDate.toISOString().slice(8, 10) +
// item.bodyProfile.birthDate.toISOString().slice(5, 7) +
// gregorianYear;
// password = formattedDate;
const _date = new Date(item.bodyProfile.birthDate.toDateString())
.getDate()
.toString()
@ -6336,7 +6329,8 @@ export class CommandController extends Controller {
name: x.name,
})),
);
} else {
}
else {
userKeycloakId = checkUser[0].id;
const rolesData = await getRoleMappings(userKeycloakId);
if (rolesData) {
@ -6397,12 +6391,12 @@ export class CommandController extends Controller {
}
await removeProfileInOrganize(profileEmployee.id, "EMPLOYEE");
if (profileEmployee.keycloak != null) {
const delUserKeycloak = await deleteUser(profileEmployee.keycloak);
if (delUserKeycloak) {
// const delUserKeycloak = await deleteUser(profileEmployee.keycloak);
// if (delUserKeycloak) {
profileEmployee.keycloak = _null;
profileEmployee.roleKeycloaks = [];
profileEmployee.isActive = false;
}
// }
}
profileEmployee.isLeave = true;
profileEmployee.leaveReason = "บรรจุข้าราชการ";