ปรับ 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"],
|
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({
|
const type = await this.posTypeRepository.findOne({
|
||||||
where: { id: String(profile?.posTypeId) },
|
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}`,
|
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||||
orgShortname: shortName,
|
orgShortname: shortName,
|
||||||
isSit: posMaster.isSit,
|
isSit: posMaster.isSit,
|
||||||
positionNextHolder:
|
profilePosition:
|
||||||
profile == null || profile.position == null ? null : profile.position,
|
profile == null || profile.position == null ? null : profile.position,
|
||||||
postypeNextHolder: type == null || type.posTypeName == null ? null : type.posTypeName,
|
profilePostype:
|
||||||
poslevelNextHolder:
|
type == null || type.posTypeName == null ? null : type.posTypeName,
|
||||||
|
profilePoslevel:
|
||||||
level == null || level.posLevelName == null ? null : level.posLevelName,
|
level == null || level.posLevelName == null ? null : level.posLevelName,
|
||||||
positions: positions.map((position) => ({
|
positions: positions.map((position) => ({
|
||||||
id: position.id,
|
id: position.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue