From 4018b9f7ceb3d1447b69bb848b1e614ff615b8c1 Mon Sep 17 00:00:00 2001 From: Adisak Date: Tue, 24 Feb 2026 17:12:23 +0700 Subject: [PATCH 1/2] fix:save dna --- src/controllers/EmployeePositionController.ts | 5 +++++ src/controllers/EmployeeTempPositionController.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 6fe825d1..39f239c4 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -679,6 +679,11 @@ export class EmployeePositionController extends Controller { posMaster.lastUpdateFullName = request.user.name; posMaster.lastUpdatedAt = new Date(); await this.employeePosMasterRepository.save(posMaster, { data: request }); + + const saved = await this.employeePosMasterRepository.save(posMaster, { data: request }); + saved.ancestorDNA = saved.id; + await this.employeePosMasterRepository.save(saved, { data: request }); + setLogDataDiff(request, { before, after: posMaster }); await Promise.all( requestBody.positions.map(async (x: any) => { diff --git a/src/controllers/EmployeeTempPositionController.ts b/src/controllers/EmployeeTempPositionController.ts index ad40ec22..d7ffdf62 100644 --- a/src/controllers/EmployeeTempPositionController.ts +++ b/src/controllers/EmployeeTempPositionController.ts @@ -546,6 +546,11 @@ export class EmployeeTempPositionController extends Controller { posMaster.lastUpdateFullName = request.user.name; posMaster.lastUpdatedAt = new Date(); await this.employeeTempPosMasterRepository.save(posMaster, { data: request }); + + const saved = await this.employeeTempPosMasterRepository.save(posMaster, { data: request }); + saved.ancestorDNA = saved.id; + await this.employeeTempPosMasterRepository.save(saved, { data: request }); + setLogDataDiff(request, { before, after: posMaster }); await Promise.all( requestBody.positions.map(async (x: any) => { From d7b45c322da34ce7d4f74e7badcda1babffe8373 Mon Sep 17 00:00:00 2001 From: harid Date: Tue, 24 Feb 2026 17:17:12 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B8=AD?= =?UTF-8?q?=E0=B8=81=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B9=80=E0=B8=9E=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B9=81?= =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=87=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87?= =?UTF-8?q?=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2=E0=B8=87?= =?UTF-8?q?=E0=B8=8A=E0=B8=B1=E0=B9=88=E0=B8=A7=E0=B8=84=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A7=20=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=95?= =?UTF-8?q?=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87=E0=B8=97?= =?UTF-8?q?=E0=B8=B5=E0=B9=88=E0=B8=95=E0=B8=B4=E0=B8=94=E0=B9=80=E0=B8=87?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/PositionController.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index a71e8bbf..f35c3632 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -4723,6 +4723,8 @@ export class PositionController extends Controller { posMaster.next_holder == null ? null : `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`, + isCondition: posMaster.isCondition, + conditionReason: posMaster.conditionReason, positions: posMaster.positions.map((position) => ({ id: position.id, positionName: position.positionName,