Browse Source

Latest Changes on holding tags

pull/5027/head
Daniel Devaud 2 years ago
parent
commit
757c91a990
  1. 42
      apps/api/src/app/order/order.service.ts
  2. 5
      apps/api/src/app/tag/tag.service.ts
  3. 14
      apps/client/src/app/components/admin-tag/admin-tag.component.html
  4. 2
      apps/client/src/app/components/admin-tag/admin-tag.component.ts

42
apps/api/src/app/order/order.service.ts

@ -298,28 +298,32 @@ export class OrderService {
} }
if (filtersByTag?.length > 0) { if (filtersByTag?.length > 0) {
where.OR = [ where.AND = [
{ {
tags: { OR: [
some: { {
OR: filtersByTag.map(({ id }) => { tags: {
return { some: {
id: id OR: filtersByTag.map(({ id }) => {
}; return {
}) id: id
} };
} })
}, }
{ }
SymbolProfile: { },
tags: { {
some: { SymbolProfile: {
OR: filtersByTag.map(({ id }) => { tags: {
return { id }; some: {
}) OR: filtersByTag.map(({ id }) => {
return { id };
})
}
}
} }
} }
} ]
} }
]; ];
} }

5
apps/api/src/app/tag/tag.service.ts

@ -50,7 +50,7 @@ export class TagService {
const tagsWithOrderCount = await this.prismaService.tag.findMany({ const tagsWithOrderCount = await this.prismaService.tag.findMany({
include: { include: {
_count: { _count: {
select: { orders: true } select: { orders: true, symbolProfile: true }
} }
} }
}); });
@ -59,7 +59,8 @@ export class TagService {
return { return {
id, id,
name, name,
activityCount: _count.orders activityCount: _count.orders,
holdingCount: _count.symbolProfile
}; };
}); });
} }

14
apps/client/src/app/components/admin-tag/admin-tag.component.html

@ -48,6 +48,20 @@
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="holdings">
<th
*matHeaderCellDef
class="px-1"
mat-header-cell
mat-sort-header="holdingCount"
>
<ng-container i18n>Holdings</ng-container>
</th>
<td *matCellDef="let element" class="px-1" mat-cell>
{{ element.holdingCount }}
</td>
</ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th <th
*matHeaderCellDef *matHeaderCellDef

2
apps/client/src/app/components/admin-tag/admin-tag.component.ts

@ -33,7 +33,7 @@ export class AdminTagComponent implements OnInit, OnDestroy {
public dataSource: MatTableDataSource<Tag> = new MatTableDataSource(); public dataSource: MatTableDataSource<Tag> = new MatTableDataSource();
public deviceType: string; public deviceType: string;
public displayedColumns = ['name', 'activities', 'actions']; public displayedColumns = ['name', 'activities', 'holdings', 'actions'];
public tags: Tag[]; public tags: Tag[];
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();

Loading…
Cancel
Save