From 870ce7dfddead3e79a83e0a9867f8b9fb3d1e8a2 Mon Sep 17 00:00:00 2001 From: kittapath Date: Wed, 19 Mar 2025 10:49:44 +0700 Subject: [PATCH] =?UTF-8?q?draft=20=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98?= =?UTF-8?q?=E0=B8=B4=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/rabbitmq.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index dab09767..7768a586 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -1274,13 +1274,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise { await posMasterRepository.save(posMaster); // Copy assignments - item.posMasterAssigns = item.posMasterAssigns.map( + posMaster.posMasterAssigns = item.posMasterAssigns.map( ({ id, ...rest }: PosMasterAssign) => ({ ...rest, posMasterId: posMaster.id, }), ); - posMaster.posMasterAssigns = item.posMasterAssigns; + await posMasterRepository.save(posMaster); // Create positions for await (const pos of item.positions) { @@ -1365,13 +1365,13 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise { await posMasterRepository.save(posMaster); // Copy assignments - item.posMasterAssigns = item.posMasterAssigns.map( + posMaster.posMasterAssigns = item.posMasterAssigns.map( ({ id, ...rest }: PosMasterAssign) => ({ ...rest, posMasterId: posMaster.id, }), ); - posMaster.posMasterAssigns = item.posMasterAssigns; + await posMasterRepository.save(posMaster); // Create positions for await (const pos of item.positions) { @@ -1464,6 +1464,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise { posMasterId: posMaster.id, }), ); + await posMasterRepository.save(posMaster); // Create positions for await (const pos of item.positions) { @@ -1558,6 +1559,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise { posMasterId: posMaster.id, }), ); + await posMasterRepository.save(posMaster); // Create positions for await (const pos of item.positions) { @@ -1655,6 +1657,7 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise { posMasterId: posMaster.id, }), ); + await posMasterRepository.save(posMaster); // Create positions for await (const pos of item.positions) {