Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-10-29 14:07:20 +07:00
commit 89fbc0225f
2 changed files with 29 additions and 20 deletions

View file

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

View file

@ -172,7 +172,7 @@ export class WorkflowController extends Controller {
let profileNow = _workflow.stateOperatorUsers
.filter((x) => _state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => ({
receiverUserId: x.profile,
receiverUserId: x.profileId,
notiLink: "",
}));
await new CallAPI()
@ -452,7 +452,7 @@ export class WorkflowController extends Controller {
let profileNow = workflow.stateOperatorUsers
.filter((x) => state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => ({
receiverUserId: x.profile,
receiverUserId: x.profileId,
notiLink: "",
}));
await new CallAPI()
@ -472,7 +472,7 @@ export class WorkflowController extends Controller {
let profileNext = workflow.stateOperatorUsers
.filter((x) => _state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => ({
receiverUserId: x.profile,
receiverUserId: x.profileId,
notiLink: "",
}));
await new CallAPI()
@ -632,7 +632,7 @@ export class WorkflowController extends Controller {
stateUserComment.state.stateOperators.map((s) => s.operator).includes(x.operator),
)
.map((x) => ({
receiverUserId: x.profile,
receiverUserId: x.profileId,
notiLink: "",
}));
await new CallAPI()