Merge branch 'develop' into develop-Bright
# Conflicts: # src/controllers/PositionController.ts
This commit is contained in:
commit
8b9b7bf4b3
2 changed files with 61 additions and 0 deletions
|
|
@ -841,6 +841,7 @@ export class PositionController extends Controller {
|
|||
where: {
|
||||
orgChild3: { orgChild3ShortName: SName },
|
||||
posMasterNo: requestBody.posMasterNo,
|
||||
orgChild4Id: IsNull(),
|
||||
id: Not(posMaster.id),
|
||||
},
|
||||
});
|
||||
|
|
@ -855,6 +856,7 @@ export class PositionController extends Controller {
|
|||
where: {
|
||||
orgChild2: { orgChild2ShortName: SName },
|
||||
posMasterNo: requestBody.posMasterNo,
|
||||
orgChild3Id: IsNull(),
|
||||
id: Not(posMaster.id),
|
||||
},
|
||||
});
|
||||
|
|
@ -869,6 +871,7 @@ export class PositionController extends Controller {
|
|||
where: {
|
||||
orgChild1: { orgChild1ShortName: SName },
|
||||
posMasterNo: requestBody.posMasterNo,
|
||||
orgChild2Id: IsNull(),
|
||||
id: Not(posMaster.id),
|
||||
},
|
||||
});
|
||||
|
|
@ -883,6 +886,7 @@ export class PositionController extends Controller {
|
|||
where: {
|
||||
orgRoot: { orgRootShortName: SName },
|
||||
posMasterNo: requestBody.posMasterNo,
|
||||
orgChild1Id: IsNull(),
|
||||
id: Not(posMaster.id),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -103,6 +103,63 @@ export class ProfileController extends Controller {
|
|||
}));
|
||||
return new HttpSuccess({ caregiver, commander, chairman });
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Get("commander")
|
||||
async getProfileCommander(@Request() request: RequestWithUser) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: request.user.sub },
|
||||
});
|
||||
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const _caregiver = await this.profileRepo.find({
|
||||
relations: { posLevel: true, posType: true },
|
||||
});
|
||||
const _commander = await this.profileRepo.find({
|
||||
relations: { posLevel: true, posType: true },
|
||||
});
|
||||
const _chairman = await this.profileRepo.find({
|
||||
relations: { posLevel: true, posType: true },
|
||||
});
|
||||
|
||||
const caregiver = _caregiver.map((_data) => ({
|
||||
id: _data.id,
|
||||
prefix: _data.prefix,
|
||||
firstName: _data.firstName,
|
||||
lastName: _data.lastName,
|
||||
citizenId: _data.citizenId,
|
||||
position: _data.position,
|
||||
posLevel: _data.posLevel == null ? null : _data.posLevel.posLevelName,
|
||||
posType: _data.posType == null ? null : _data.posType.posTypeName,
|
||||
isDirector: true,
|
||||
}));
|
||||
const commander = _commander.map((_data) => ({
|
||||
id: _data.id,
|
||||
prefix: _data.prefix,
|
||||
firstName: _data.firstName,
|
||||
lastName: _data.lastName,
|
||||
citizenId: _data.citizenId,
|
||||
position: _data.position,
|
||||
posLevel: _data.posLevel == null ? null : _data.posLevel.posLevelName,
|
||||
posType: _data.posType == null ? null : _data.posType.posTypeName,
|
||||
isDirector: true,
|
||||
}));
|
||||
const chairman = _chairman.map((_data) => ({
|
||||
id: _data.id,
|
||||
prefix: _data.prefix,
|
||||
firstName: _data.firstName,
|
||||
lastName: _data.lastName,
|
||||
citizenId: _data.citizenId,
|
||||
position: _data.position,
|
||||
posLevel: _data.posLevel == null ? null : _data.posLevel.posLevelName,
|
||||
posType: _data.posType == null ? null : _data.posType.posTypeName,
|
||||
isDirector: true,
|
||||
}));
|
||||
return new HttpSuccess({ caregiver, commander, chairman });
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างทะเบียนประวัติ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue