แก้สิทธิ์

This commit is contained in:
kittapath 2025-03-19 13:32:48 +07:00
parent 870ce7dfdd
commit a0244f2b61

View file

@ -1238,7 +1238,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
(x: PosMaster) => x.orgRootId == dataId && x.orgChild1Id == null,
) as any) {
delete item.id;
const posMaster: any = Object.assign(new PosMaster(), item);
const posMaster = Object.assign(new PosMaster(), item);
posMaster.positions = [];
if (
@ -1274,13 +1274,12 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster);
// Copy assignments
posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({
await posMasterAssignRepository.save(
item.posMasterAssigns.map(({ id, ...rest }: PosMasterAssign) => ({
...rest,
posMasterId: posMaster.id,
}),
})),
);
await posMasterRepository.save(posMaster);
// Create positions
for await (const pos of item.positions) {
@ -1365,13 +1364,12 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster);
// Copy assignments
posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({
await posMasterAssignRepository.save(
item.posMasterAssigns.map(({ id, ...rest }: PosMasterAssign) => ({
...rest,
posMasterId: posMaster.id,
}),
})),
);
await posMasterRepository.save(posMaster);
// Create positions
for await (const pos of item.positions) {
@ -1458,13 +1456,12 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster);
// Copy assignments
posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({
await posMasterAssignRepository.save(
item.posMasterAssigns.map(({ id, ...rest }: PosMasterAssign) => ({
...rest,
posMasterId: posMaster.id,
}),
})),
);
await posMasterRepository.save(posMaster);
// Create positions
for await (const pos of item.positions) {
@ -1553,13 +1550,12 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster);
// Copy assignments
posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({
await posMasterAssignRepository.save(
item.posMasterAssigns.map(({ id, ...rest }: PosMasterAssign) => ({
...rest,
posMasterId: posMaster.id,
}),
})),
);
await posMasterRepository.save(posMaster);
// Create positions
for await (const pos of item.positions) {
@ -1651,13 +1647,12 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster);
// Copy assignments
posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({
await posMasterAssignRepository.save(
item.posMasterAssigns.map(({ id, ...rest }: PosMasterAssign) => ({
...rest,
posMasterId: posMaster.id,
}),
})),
);
await posMasterRepository.save(posMaster);
// Create positions
for await (const pos of item.positions) {