add log check isSelected in position
Some checks failed
Build & Deploy on Dev / build (push) Failing after 39s
Some checks failed
Build & Deploy on Dev / build (push) Failing after 39s
This commit is contained in:
parent
0c7c8e9fd3
commit
e0f2513ba4
3 changed files with 67 additions and 6 deletions
|
|
@ -38,7 +38,7 @@ import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
|||
import { AuthRole } from "../entities/AuthRole";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
import { resolveNodeLevel, setLogDataDiff } from "../interfaces/utils";
|
||||
import { resolveNodeLevel, setLogDataDiff, logPositionIsSelectedChange } from "../interfaces/utils";
|
||||
import { getPosMasterNo, getOrgFullName } from "../utils/org-formatting";
|
||||
import { PosMasterAssign } from "../entities/PosMasterAssign";
|
||||
import { Assign } from "../entities/Assign";
|
||||
|
|
@ -1427,7 +1427,17 @@ export class PositionController extends Controller {
|
|||
requestBody.positions.map(async (x: any) => {
|
||||
const match = posMaster.positions.find((p: any) => p.id == x.id);
|
||||
if (match) {
|
||||
match.positionIsSelected = x.positionIsSelected ?? false;
|
||||
const oldValue = match.positionIsSelected;
|
||||
const newValue = x.positionIsSelected ?? false;
|
||||
|
||||
logPositionIsSelectedChange(match.id, oldValue, newValue, {
|
||||
posMasterId: posMaster.id,
|
||||
userId: request.user.sub,
|
||||
endpoint: "updateMaster",
|
||||
action: "update_position",
|
||||
});
|
||||
|
||||
match.positionIsSelected = newValue;
|
||||
match.orderNo = x.orderNo ?? null;
|
||||
return match;
|
||||
} else {
|
||||
|
|
@ -4034,7 +4044,18 @@ export class PositionController extends Controller {
|
|||
statusReport: "PENDING",
|
||||
});
|
||||
|
||||
console.log(
|
||||
`[positionIsSelected-DEBUG] Deleting holder, resetting ALL positions to false (posMasterId: ${id}, userId: ${request.user.sub}, endpoint: deleteHolder)`
|
||||
);
|
||||
|
||||
dataMaster.positions.forEach(async (position) => {
|
||||
logPositionIsSelectedChange(position.id, position.positionIsSelected, false, {
|
||||
posMasterId: id,
|
||||
userId: request.user.sub,
|
||||
endpoint: "deleteHolder",
|
||||
action: "delete_holder_reset_positions",
|
||||
});
|
||||
|
||||
await this.positionRepository.update(position.id, {
|
||||
positionIsSelected: false,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue