add log check isSelected in position
Some checks failed
Build & Deploy on Dev / build (push) Failing after 39s

This commit is contained in:
Warunee Tamkoo 2026-05-23 00:23:55 +07:00
parent 0c7c8e9fd3
commit e0f2513ba4
3 changed files with 67 additions and 6 deletions

View file

@ -44,6 +44,7 @@ import {
checkExceptCommandType,
checkCommandType,
removePostMasterAct,
logPositionIsSelectedChange,
} from "../interfaces/utils";
import { Position } from "../entities/Position";
import { PosMaster } from "../entities/PosMaster";
@ -3751,6 +3752,13 @@ export class CommandController extends Controller {
},
});
if (positionOld != null) {
logPositionIsSelectedChange(positionOld.id, positionOld.positionIsSelected, false, {
posMasterId: posMasterOld?.id,
userId: request.user.sub,
endpoint: "updateMaster",
action: "command_change_reset_old_position",
});
positionOld.positionIsSelected = false;
await this.positionRepository.save(positionOld);
}
@ -3762,10 +3770,23 @@ export class CommandController extends Controller {
},
});
if (checkPosition.length > 0) {
const clearPosition = checkPosition.map((positions) => ({
...positions,
positionIsSelected: false,
}));
console.log(
`[positionIsSelected-DEBUG] Command change: clearing ${checkPosition.length} positions (posMasterId: ${posMaster.id}, userId: ${request.user.sub}, endpoint: updateMaster)`
);
const clearPosition = checkPosition.map((positions) => {
logPositionIsSelectedChange(positions.id, positions.positionIsSelected, false, {
posMasterId: posMaster.id,
userId: request.user.sub,
endpoint: "updateMaster",
action: "command_change_clear_positions",
});
return {
...positions,
positionIsSelected: false,
};
});
await this.positionRepository.save(clearPosition);
}