From 13687b41cb111d37117fae8d7736c6f06ac61306 Mon Sep 17 00:00:00 2001 From: adisak Date: Wed, 3 Sep 2025 14:37:29 +0700 Subject: [PATCH] test command save history --- src/controllers/CommandController.ts | 6 +++--- src/controllers/PositionController.ts | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index ca2352c5..983b6bb3 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3171,7 +3171,6 @@ export class CommandController extends Controller { await CreatePosMasterHistoryOfficer(posMasterOld.id, req); } await this.posMasterRepository.save(posMaster); - await CreatePosMasterHistoryOfficer(posMaster.id, req); const positionNew = await this.positionRepository.findOne({ where: { @@ -3189,6 +3188,7 @@ export class CommandController extends Controller { await this.profileRepository.save(profile); await this.positionRepository.save(positionNew); } + await CreatePosMasterHistoryOfficer(posMaster.id, req); }), ); @@ -3592,7 +3592,6 @@ export class CommandController extends Controller { posMaster.conditionReason = _null; posMaster.isCondition = false; await this.posMasterRepository.save(posMaster); - await CreatePosMasterHistoryOfficer(posMaster.id, req); const positionNew = await this.positionRepository.findOne({ where: { posMasterId: posMaster.id, @@ -3602,6 +3601,7 @@ export class CommandController extends Controller { positionNew.positionIsSelected = true; await this.positionRepository.save(positionNew, { data: req }); } + await CreatePosMasterHistoryOfficer(posMaster.id, req); } const newMapProfileSalary = { profileId: profile.id, @@ -6055,7 +6055,6 @@ export class CommandController extends Controller { await CreatePosMasterHistoryOfficer(posMasterOld.id, req); } await this.posMasterRepository.save(posMaster); - await CreatePosMasterHistoryOfficer(posMaster.id, req); const positionNew = await this.positionRepository.findOne({ where: { @@ -6073,6 +6072,7 @@ export class CommandController extends Controller { setLogDataDiff(req, { before, after: profile }); await this.positionRepository.save(positionNew, { data: req }); } + await CreatePosMasterHistoryOfficer(posMaster.id, req); } // Insignia if (_oldInsigniaIds.length > 0) { diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 8356a773..e63e4f64 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -4924,7 +4924,7 @@ export class PositionController extends Controller { await CreatePosMasterHistoryOfficer(posMasterOld.id, request); } await this.posMasterRepository.save(posMaster); - + await CreatePosMasterHistoryOfficer(posMaster.id, request); const positionNew = await this.positionRepository.findOne({ where: { @@ -4940,7 +4940,6 @@ export class PositionController extends Controller { await this.profileRepository.save(profile); await this.positionRepository.save(positionNew); } - await CreatePosMasterHistoryOfficer(posMaster.id, request); return new HttpSuccess(); }