add fields api master/list
This commit is contained in:
parent
507b527c5e
commit
edd5fdb3aa
1 changed files with 15 additions and 1 deletions
|
|
@ -33,6 +33,7 @@ import { OrgChild2 } from "../entities/OrgChild2";
|
||||||
import { OrgChild3 } from "../entities/OrgChild3";
|
import { OrgChild3 } from "../entities/OrgChild3";
|
||||||
import { OrgChild4 } from "../entities/OrgChild4";
|
import { OrgChild4 } from "../entities/OrgChild4";
|
||||||
import { Position } from "../entities/Position";
|
import { Position } from "../entities/Position";
|
||||||
|
import { Profile } from "../entities/Profile";
|
||||||
@Route("api/v1/org/pos")
|
@Route("api/v1/org/pos")
|
||||||
@Tags("Position")
|
@Tags("Position")
|
||||||
// @Security("bearerAuth")
|
// @Security("bearerAuth")
|
||||||
|
|
@ -48,7 +49,7 @@ export class PositionController extends Controller {
|
||||||
private posDictRepository = AppDataSource.getRepository(PosDict);
|
private posDictRepository = AppDataSource.getRepository(PosDict);
|
||||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||||
private positionRepository = AppDataSource.getRepository(Position);
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
|
private profileRepository = AppDataSource.getRepository(Profile);
|
||||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||||
private child1Repository = AppDataSource.getRepository(OrgChild1);
|
private child1Repository = AppDataSource.getRepository(OrgChild1);
|
||||||
|
|
@ -887,6 +888,15 @@ 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) }
|
||||||
|
})
|
||||||
|
const type = await this.posTypeRepository.findOne({
|
||||||
|
where: { id: String(profile?.posTypeId) }
|
||||||
|
})
|
||||||
|
const level = await this.posLevelRepository.findOne({
|
||||||
|
where: { id: String(profile?.posLevelId)}
|
||||||
|
})
|
||||||
|
|
||||||
let shortName = "";
|
let shortName = "";
|
||||||
|
|
||||||
|
|
@ -953,6 +963,10 @@ export class PositionController extends Controller {
|
||||||
? null
|
? null
|
||||||
: `${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,
|
||||||
|
positionNextHolder: profile == null || profile.position == null? null : profile.position,
|
||||||
|
postypeNextHolder: type == null || type.posTypeName == null ? null : type.posTypeName,
|
||||||
|
poslevelNextHolder: level == null || level.posLevelName == null ? null : level.posLevelName,
|
||||||
positions: positions.map((position) => ({
|
positions: positions.map((position) => ({
|
||||||
id: position.id,
|
id: position.id,
|
||||||
positionName: position.positionName,
|
positionName: position.positionName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue