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();