เพิ่มฟิว ตำแหน่งทางการบริหาร
This commit is contained in:
parent
e5f71ba90d
commit
2217355dea
1 changed files with 41 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ import { PosLevel } from "../entities/PosLevel";
|
||||||
import { PosType } from "../entities/PosType";
|
import { PosType } from "../entities/PosType";
|
||||||
import { calculateAge, calculateRetireDate, calculateRetireYear } from "../interfaces/utils";
|
import { calculateAge, calculateRetireDate, calculateRetireYear } from "../interfaces/utils";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
|
import { Position } from "../entities/Position";
|
||||||
|
|
||||||
@Route("api/v1/org/profile")
|
@Route("api/v1/org/profile")
|
||||||
@Tags("Profile")
|
@Tags("Profile")
|
||||||
|
|
@ -50,6 +51,7 @@ export class ProfileController extends Controller {
|
||||||
private posLevelRepo = AppDataSource.getRepository(PosLevel);
|
private posLevelRepo = AppDataSource.getRepository(PosLevel);
|
||||||
private posTypeRepo = AppDataSource.getRepository(PosType);
|
private posTypeRepo = AppDataSource.getRepository(PosType);
|
||||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||||
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -752,6 +754,14 @@ export class ProfileController extends Controller {
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id) == null
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||||
|
|
||||||
|
const position = await this.positionRepository.findOne({
|
||||||
|
relations: ["posExecutive"],
|
||||||
|
where: {
|
||||||
|
posMasterId: posMaster?.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const _profile: any = {
|
const _profile: any = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
|
|
@ -767,6 +777,15 @@ export class ProfileController extends Controller {
|
||||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
|
posExecutiveName: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutiveName,
|
||||||
|
posExecutivePriority: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutivePriority,
|
||||||
|
posExecutiveId: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.id,
|
||||||
rootId:
|
rootId:
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null ||
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
||||||
|
|
@ -1911,6 +1930,19 @@ export class ProfileController extends Controller {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
|
where: {
|
||||||
|
current_holderId: profile.id,
|
||||||
|
orgRevisionId: revisionId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const position = await this.positionRepository.findOne({
|
||||||
|
relations: ["posExecutive"],
|
||||||
|
where: {
|
||||||
|
posMasterId: posMaster?.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const _profile = {
|
const _profile = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
prefix: profile.prefix,
|
prefix: profile.prefix,
|
||||||
|
|
@ -1925,6 +1957,15 @@ export class ProfileController extends Controller {
|
||||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
|
posExecutiveName: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutiveName,
|
||||||
|
posExecutivePriority: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.posExecutivePriority,
|
||||||
|
posExecutiveId: position == null || position.posExecutive == null
|
||||||
|
? null
|
||||||
|
: position.posExecutive.id,
|
||||||
rootId:
|
rootId:
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null ||
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == revisionId) == null ||
|
profile.current_holders.find((x) => x.orgRevisionId == revisionId) == null ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue