แก้สิทธิ์

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