From 7651021e316b1afbbd7200b4134de973735bde8c Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:01:02 +0100 Subject: [PATCH] Expire snapshot cache on holding tags change --- apps/api/src/app/order/order.service.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index e80811351..a26099e9d 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -63,14 +63,14 @@ export class OrderService { } }); - return Promise.all( + await Promise.all( orders.map(({ id }) => this.prismaService.order.update({ data: { tags: { // The set operation replaces all existing connections with the provided ones - set: tags.map(({ id }) => { - return { id }; + set: tags.map((tag) => { + return { id: tag.id }; }) } }, @@ -78,6 +78,13 @@ export class OrderService { }) ) ); + + this.eventEmitter.emit( + PortfolioChangedEvent.getName(), + new PortfolioChangedEvent({ + userId + }) + ); } public async createOrder(