diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index ff88a6a4..cb8d16da 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -4926,17 +4926,15 @@ export class CommandController extends Controller { posMasters.map(async (item) => { if (item.posMasterChild != null && item.posMasterChild.current_holderId != null) { // ประวัติคำสั่งให้รักษาการแทน - const dataAct = new ProfileActposition(); const _actposition = await this.actpositionRepository.find({ where: { profileId: item.posMasterChild.current_holderId }, }); - const data = _actposition.map((_data) => ({ + const profileActs = _actposition.map((_data) => ({ ..._data, status: false, dateEnd: _data.status == true ? new Date() : _data.dateEnd, })); - await this.posMasterActRepository.save(data); - item.posMasterChild.current_holderId; + await this.actpositionRepository.save(profileActs); const shortName = item.posMaster != null && item.posMaster.orgChild4 != null @@ -4968,6 +4966,7 @@ export class CommandController extends Controller { lastUpdatedAt: new Date(), }; + const dataAct = new ProfileActposition(); Object.assign(dataAct, metaAct); const historyAct = new ProfileActpositionHistory(); Object.assign(historyAct, { ...dataAct, id: undefined });