no message

This commit is contained in:
kittapath 2024-08-16 14:19:02 +07:00
parent e2a7334c5b
commit 932d4b94e9

View file

@ -60,6 +60,7 @@ import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory";
import { ProfileLeave } from "../entities/ProfileLeave";
import { updateName } from "../keycloak";
import permission from "../interfaces/permission";
import { PosMasterAct } from "../entities/PosMasterAct";
@Route("api/v1/org/profile")
@Tags("Profile")
@Security("bearerAuth")
@ -97,6 +98,8 @@ export class ProfileController extends Controller {
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
/**
* report
*
@ -3167,6 +3170,58 @@ export class ProfileController extends Controller {
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
: null;
const posMasterActs = await this.posMasterActRepository.find({
relations: [
"posMaster",
"posMaster.orgRoot",
"posMaster.orgChild1",
"posMaster.orgChild2",
"posMaster.orgChild3",
"posMaster.orgChild4",
"posMaster.current_holder",
"posMaster.current_holder.posLevel",
"posMaster.current_holder.posType",
],
where: {
posMaster: {
orgRevisionId: orgRevisionPublish.id,
},
posMasterChild: {
current_holderId: profile.id,
},
},
});
const data = await Promise.all(
posMasterActs
.sort((a, b) => a.posMaster.posMasterOrder - b.posMaster.posMasterOrder)
.map((item) => {
const shortName =
item.posMaster != null && item.posMaster.orgChild4 != null
? `${item.posMaster.orgChild4.orgChild4ShortName}${item.posMaster.posMasterNo}`
: item.posMaster != null && item.posMaster?.orgChild3 != null
? `${item.posMaster.orgChild3.orgChild3ShortName}${item.posMaster.posMasterNo}`
: item.posMaster != null && item.posMaster?.orgChild2 != null
? `${item.posMaster.orgChild2.orgChild2ShortName}${item.posMaster.posMasterNo}`
: item.posMaster != null && item.posMaster?.orgChild1 != null
? `${item.posMaster.orgChild1.orgChild1ShortName}${item.posMaster.posMasterNo}`
: item.posMaster != null && item.posMaster?.orgRoot != null
? `${item.posMaster.orgRoot.orgRootShortName}${item.posMaster.posMasterNo}`
: null;
return {
id: item.id,
posMasterOrder: item.posMasterOrder,
profileId: item.posMaster?.current_holder?.id ?? null,
citizenId: item.posMaster?.current_holder?.citizenId ?? null,
prefix: item.posMaster?.current_holder?.prefix ?? null,
firstName: item.posMaster?.current_holder?.firstName ?? null,
lastName: item.posMaster?.current_holder?.lastName ?? null,
posLevel: item.posMaster?.current_holder?.posLevel?.posLevelName ?? null,
posType: item.posMaster?.current_holder?.posType?.posTypeName ?? null,
position: item.posMaster?.current_holder?.position ?? null,
posNo: shortName,
};
}),
);
const _profile: any = {
profileId: profile.id,
prefix: profile.prefix,
@ -3207,6 +3262,8 @@ export class ProfileController extends Controller {
node: null,
nodeId: null,
posNo: shortName,
isPosmasterAct: data.length > 0,
posmasterAct: data,
};
if (_profile.child4Id != null) {