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) {
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 };
})
}
}
}
}
}
]
}
];
}

5
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
};
});
}

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

@ -48,6 +48,20 @@
</td>
</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">
<th
*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 deviceType: string;
public displayedColumns = ['name', 'activities', 'actions'];
public displayedColumns = ['name', 'activities', 'holdings', 'actions'];
public tags: Tag[];
private unsubscribeSubject = new Subject<void>();

Loading…
Cancel
Save