ปรับ api master/list
This commit is contained in:
parent
d76af2c88c
commit
a1610880f0
1 changed files with 19 additions and 6 deletions
|
|
@ -849,9 +849,21 @@ export class PositionController extends Controller {
|
|||
},
|
||||
relations: ["posLevel", "posType", "posExecutive"],
|
||||
});
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id: String(posMaster.next_holderId) },
|
||||
});
|
||||
|
||||
let profile: any;
|
||||
const chkRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: posMaster.orgRevisionId }
|
||||
})
|
||||
if(chkRevision?.orgRevisionIsCurrent && !chkRevision?.orgRevisionIsDraft){
|
||||
profile = await this.profileRepository.findOne({
|
||||
where: { id: String(posMaster.current_holderId) },
|
||||
});
|
||||
}
|
||||
else if(!chkRevision?.orgRevisionIsCurrent && chkRevision?.orgRevisionIsDraft){
|
||||
profile = await this.profileRepository.findOne({
|
||||
where: { id: String(posMaster.next_holderId) },
|
||||
});
|
||||
}
|
||||
const type = await this.posTypeRepository.findOne({
|
||||
where: { id: String(profile?.posTypeId) },
|
||||
});
|
||||
|
|
@ -925,10 +937,11 @@ export class PositionController extends Controller {
|
|||
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||
orgShortname: shortName,
|
||||
isSit: posMaster.isSit,
|
||||
positionNextHolder:
|
||||
profilePosition:
|
||||
profile == null || profile.position == null ? null : profile.position,
|
||||
postypeNextHolder: type == null || type.posTypeName == null ? null : type.posTypeName,
|
||||
poslevelNextHolder:
|
||||
profilePostype:
|
||||
type == null || type.posTypeName == null ? null : type.posTypeName,
|
||||
profilePoslevel:
|
||||
level == null || level.posLevelName == null ? null : level.posLevelName,
|
||||
positions: positions.map((position) => ({
|
||||
id: position.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue