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) {