no message

This commit is contained in:
kittapath 2024-10-29 12:23:37 +07:00
parent c3eea0687f
commit 29a574035e
2 changed files with 25 additions and 17 deletions

View file

@ -1840,7 +1840,7 @@ export class CommandController extends Controller {
profile.posLevelId = _null; profile.posLevelId = _null;
} }
const returnWork = await checkReturnCommandType(String(item.commandId)); const returnWork = await checkReturnCommandType(String(item.commandId));
if(returnWork && item.isGovernment) { if (returnWork && item.isGovernment) {
const userKeycloakId = await createUser(profile.citizenId, profile.citizenId, { const userKeycloakId = await createUser(profile.citizenId, profile.citizenId, {
firstName: profile.firstName, firstName: profile.firstName,
lastName: profile.lastName, lastName: profile.lastName,
@ -2204,26 +2204,32 @@ export class CommandController extends Controller {
// ทะเบียนประวัติ // ทะเบียนประวัติ
if (item.isLeave != null) { if (item.isLeave != null) {
const _profile = await this.profileRepository.findOne({
where: { id: item.profileId },
});
if (!_profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
}
const _null: any = null; const _null: any = null;
profile.isLeave = item.isLeave; _profile.isLeave = item.isLeave;
profile.leaveReason = item.leaveReason ?? _null; _profile.leaveReason = item.leaveReason ?? _null;
profile.dateLeave = item.dateLeave ?? _null; _profile.dateLeave = item.dateLeave ?? _null;
profile.lastUpdateUserId = req.user.sub; _profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name; _profile.lastUpdateFullName = req.user.name;
profile.lastUpdatedAt = new Date(); _profile.lastUpdatedAt = new Date();
const exceptClear = await checkExceptCommandType(String(item.commandId)); const exceptClear = await checkExceptCommandType(String(item.commandId));
if (item.isLeave == true && !exceptClear) { if (item.isLeave == true && !exceptClear) {
await removeProfileInOrganize(profile.id, "OFFICER"); await removeProfileInOrganize(_profile.id, "OFFICER");
} }
const clearProfile = await checkCommandType(String(item.commandId)); const clearProfile = await checkCommandType(String(item.commandId));
if (clearProfile) { if (clearProfile) {
if (profile.keycloak != null) { if (_profile.keycloak != null) {
const delUserKeycloak = await deleteUser(profile.keycloak); const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) profile.keycloak = _null; if (delUserKeycloak) _profile.keycloak = _null;
} }
profile.position = _null; _profile.position = _null;
profile.posTypeId = _null; _profile.posTypeId = _null;
profile.posLevelId = _null; _profile.posLevelId = _null;
} }
await this.profileRepository.save(profile); await this.profileRepository.save(profile);
} }
@ -2870,7 +2876,7 @@ export class CommandController extends Controller {
RemarkHorizontal?: any | null; RemarkHorizontal?: any | null;
RemarkVertical?: any | null; RemarkVertical?: any | null;
CommandYear?: any | null; CommandYear?: any | null;
}[]; }[];
}, },
) { ) {
let data: any = []; let data: any = [];
@ -2933,7 +2939,10 @@ export class CommandController extends Controller {
"" + posMasterAct.posMasterChild?.current_holder?.firstName ?? "" + posMasterAct.posMasterChild?.current_holder?.firstName ??
"" + " " + posMasterAct.posMasterChild?.current_holder?.lastName ?? "" + " " + posMasterAct.posMasterChild?.current_holder?.lastName ??
null, null,
oc: (posMasterAct.posMasterChild?.current_holder?.position ?? "-") + "/" + (_organization ?? "-"), oc:
(posMasterAct.posMasterChild?.current_holder?.position ?? "-") +
"/" +
(_organization ?? "-"),
postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? "-", postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? "-",
poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-", poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-",
organizationNew: _organizationNew ?? "-", organizationNew: _organizationNew ?? "-",

View file

@ -175,7 +175,6 @@ export class WorkflowController extends Controller {
receiverUserId: x.profileId, receiverUserId: x.profileId,
notiLink: "", notiLink: "",
})); }));
console.log(profileNow);
await new CallAPI() await new CallAPI()
.PostData(req, "/placement/noti/profiles", { .PostData(req, "/placement/noti/profiles", {
subject: `รายการถูกส่ง`, subject: `รายการถูกส่ง`,