This commit is contained in:
AdisakKanthawilang 2025-08-22 10:19:29 +07:00
parent 53e7badead
commit 65a8c757d7
3 changed files with 13 additions and 4 deletions

View file

@ -1236,7 +1236,11 @@ export class PositionController extends Controller {
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request, "SYS_ORG");
const posMaster = await this.posMasterRepository.findOne({ where: { id: id } });
const posMaster = await this.posMasterRepository.findOne({
relations: ["positions"],
where: { id: id }
}
);
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
}
@ -1399,6 +1403,11 @@ export class PositionController extends Controller {
match.positionIsSelected = x.positionIsSelected??false;
return match
}else{
x.id = x.id ?? undefined;
x.posMasterId = posMaster.id;
x.positionName = x.posDictName;
x.positionField = x.posDictField;
x.posExecutiveId = x.posExecutiveId || null
x.createdUserId = request.user.sub;
x.createdFullName = request.user.name;
x.lastUpdateUserId = request.user.sub;