no message
This commit is contained in:
parent
5a634b4dd3
commit
b11be3364f
7 changed files with 201 additions and 125 deletions
|
|
@ -1056,7 +1056,7 @@ export class EmployeePositionController extends Controller {
|
|||
});
|
||||
|
||||
const authRoleName = await this.authRoleRepo.findOne({
|
||||
where: { id: String(posMaster.authRoleId) }
|
||||
where: { id: String(posMaster.authRoleId) },
|
||||
});
|
||||
|
||||
let profile: any;
|
||||
|
|
@ -1149,7 +1149,8 @@ export class EmployeePositionController extends Controller {
|
|||
profilePoslevel:
|
||||
level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`,
|
||||
authRoleId: posMaster.authRoleId,
|
||||
authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
|
||||
authRoleName:
|
||||
authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
|
||||
positions: positions.map((position) => ({
|
||||
id: position.id,
|
||||
positionName: position.positionName,
|
||||
|
|
@ -2150,4 +2151,46 @@ export class EmployeePositionController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API บันทึกตำแหน่งใหม่
|
||||
*
|
||||
* @summary บันทึกตำแหน่งใหม่
|
||||
*
|
||||
*/
|
||||
@Post("report/current")
|
||||
async reportApproveCurrent(
|
||||
@Body()
|
||||
body: {
|
||||
posmasterId: string;
|
||||
positionId: string;
|
||||
profileId: string;
|
||||
},
|
||||
) {
|
||||
const posMaster = await this.employeePosMasterRepository.findOne({
|
||||
where: { id: body.posmasterId },
|
||||
});
|
||||
if (posMaster == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
|
||||
|
||||
const posMasterOld = await this.employeePosMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: body.profileId,
|
||||
orgRevisionId: posMaster.orgRevisionId,
|
||||
},
|
||||
});
|
||||
if (posMasterOld != null) posMasterOld.current_holderId = null;
|
||||
if (posMasterOld != null) posMasterOld.next_holderId = null;
|
||||
|
||||
const profile = await this.profileRepository.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
if (profile == null)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
|
||||
|
||||
posMaster.current_holderId = body.profileId;
|
||||
posMaster.next_holderId = body.profileId;
|
||||
if (posMasterOld != null) await this.employeePosMasterRepository.save(posMasterOld);
|
||||
await this.employeePosMasterRepository.save(posMaster);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue