no message
This commit is contained in:
parent
e2a7334c5b
commit
932d4b94e9
1 changed files with 57 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory";
|
||||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||||
import { updateName } from "../keycloak";
|
import { updateName } from "../keycloak";
|
||||||
import permission from "../interfaces/permission";
|
import permission from "../interfaces/permission";
|
||||||
|
import { PosMasterAct } from "../entities/PosMasterAct";
|
||||||
@Route("api/v1/org/profile")
|
@Route("api/v1/org/profile")
|
||||||
@Tags("Profile")
|
@Tags("Profile")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -97,6 +98,8 @@ export class ProfileController extends Controller {
|
||||||
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
|
private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline);
|
||||||
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
|
private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory);
|
||||||
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
|
||||||
|
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* report ประวัติแบบย่อ ข้าราชการ
|
* report ประวัติแบบย่อ ข้าราชการ
|
||||||
*
|
*
|
||||||
|
|
@ -3167,6 +3170,58 @@ export class ProfileController extends Controller {
|
||||||
?.orgRoot != null
|
?.orgRoot != null
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.posMasterNo}`
|
||||||
: null;
|
: 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 = {
|
const _profile: any = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
|
|
@ -3207,6 +3262,8 @@ export class ProfileController extends Controller {
|
||||||
node: null,
|
node: null,
|
||||||
nodeId: null,
|
nodeId: null,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
|
isPosmasterAct: data.length > 0,
|
||||||
|
posmasterAct: data,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_profile.child4Id != null) {
|
if (_profile.child4Id != null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue