Migrate อัตรากำลังลูกจ้างประจำ เพิ่มเมนูคัดลอก/จัดการตำแหน่งติดเงื่อนไข #2316
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m25s

&& Fix Bug กดลบถาวรคำสั่งแล้ว error #216
This commit is contained in:
harid 2026-02-23 15:06:32 +07:00
parent 673da9940d
commit f6c726baa5
4 changed files with 66 additions and 0 deletions

View file

@ -940,6 +940,35 @@ export class EmployeePositionController extends Controller {
return new HttpSuccess(posMaster.id);
}
/**
* @summary (ADMIN)
*/
@Put("master/position-condition/{id}")
async updatePositionCondition(
@Path() id: string,
@Body()
requestBody: {
isCondition: boolean | null;
conditionReason: string | null;
},
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request, "SYS_POS_CONDITION");
const posMaster = await this.employeePosMasterRepository.findOne({
where: { id: id },
});
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
Object.assign(posMaster, requestBody);
posMaster.lastUpdateUserId = request.user.sub;
posMaster.lastUpdateFullName = request.user.name;
posMaster.lastUpdatedAt = new Date();
await this.employeePosMasterRepository.save(posMaster);
return new HttpSuccess();
}
/**
* API
*
@ -1369,6 +1398,8 @@ export class EmployeePositionController extends Controller {
profilePoslevel:
level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`,
authRoleId: posMaster.authRoleId,
isCondition: posMaster.isCondition,
conditionReason: posMaster.conditionReason,
authRoleName:
authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
positions: positions.map((position) => ({