draft สิทธิ์

This commit is contained in:
kittapath 2025-03-19 10:49:44 +07:00
parent 074e953988
commit 870ce7dfdd

View file

@ -1274,13 +1274,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster); await posMasterRepository.save(posMaster);
// Copy assignments // Copy assignments
item.posMasterAssigns = item.posMasterAssigns.map( posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({ ({ id, ...rest }: PosMasterAssign) => ({
...rest, ...rest,
posMasterId: posMaster.id, posMasterId: posMaster.id,
}), }),
); );
posMaster.posMasterAssigns = item.posMasterAssigns; await posMasterRepository.save(posMaster);
// Create positions // Create positions
for await (const pos of item.positions) { for await (const pos of item.positions) {
@ -1365,13 +1365,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
await posMasterRepository.save(posMaster); await posMasterRepository.save(posMaster);
// Copy assignments // Copy assignments
item.posMasterAssigns = item.posMasterAssigns.map( posMaster.posMasterAssigns = item.posMasterAssigns.map(
({ id, ...rest }: PosMasterAssign) => ({ ({ id, ...rest }: PosMasterAssign) => ({
...rest, ...rest,
posMasterId: posMaster.id, posMasterId: posMaster.id,
}), }),
); );
posMaster.posMasterAssigns = item.posMasterAssigns; await posMasterRepository.save(posMaster);
// Create positions // Create positions
for await (const pos of item.positions) { for await (const pos of item.positions) {
@ -1464,6 +1464,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
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) {
@ -1558,6 +1559,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
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) {
@ -1655,6 +1657,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
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) {