From 757c91a9904304b29d3161d9c5234d761ffb6975 Mon Sep 17 00:00:00 2001 From: Daniel Devaud Date: Wed, 8 Nov 2023 08:50:54 +0100 Subject: [PATCH] Latest Changes on holding tags --- apps/api/src/app/order/order.service.ts | 42 ++++++++++--------- apps/api/src/app/tag/tag.service.ts | 5 ++- .../admin-tag/admin-tag.component.html | 14 +++++++ .../admin-tag/admin-tag.component.ts | 2 +- 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 78d153115..3c228bc79 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -298,28 +298,32 @@ export class OrderService { } if (filtersByTag?.length > 0) { - where.OR = [ + where.AND = [ { - tags: { - some: { - OR: filtersByTag.map(({ id }) => { - return { - id: id - }; - }) - } - } - }, - { - SymbolProfile: { - tags: { - some: { - OR: filtersByTag.map(({ id }) => { - return { id }; - }) + OR: [ + { + tags: { + some: { + OR: filtersByTag.map(({ id }) => { + return { + id: id + }; + }) + } + } + }, + { + SymbolProfile: { + tags: { + some: { + OR: filtersByTag.map(({ id }) => { + return { id }; + }) + } + } } } - } + ] } ]; } diff --git a/apps/api/src/app/tag/tag.service.ts b/apps/api/src/app/tag/tag.service.ts index 9da7cc475..674f6aa92 100644 --- a/apps/api/src/app/tag/tag.service.ts +++ b/apps/api/src/app/tag/tag.service.ts @@ -50,7 +50,7 @@ export class TagService { const tagsWithOrderCount = await this.prismaService.tag.findMany({ include: { _count: { - select: { orders: true } + select: { orders: true, symbolProfile: true } } } }); @@ -59,7 +59,8 @@ export class TagService { return { id, name, - activityCount: _count.orders + activityCount: _count.orders, + holdingCount: _count.symbolProfile }; }); } diff --git a/apps/client/src/app/components/admin-tag/admin-tag.component.html b/apps/client/src/app/components/admin-tag/admin-tag.component.html index b08ae96d4..5081a3d69 100644 --- a/apps/client/src/app/components/admin-tag/admin-tag.component.html +++ b/apps/client/src/app/components/admin-tag/admin-tag.component.html @@ -48,6 +48,20 @@ + + + Holdings + + + {{ element.holdingCount }} + + + = new MatTableDataSource(); public deviceType: string; - public displayedColumns = ['name', 'activities', 'actions']; + public displayedColumns = ['name', 'activities', 'holdings', 'actions']; public tags: Tag[]; private unsubscribeSubject = new Subject();