Browse Source

Update isUsed flag

pull/3859/head
Matej Gerek 11 months ago
committed by Thomas Kaul
parent
commit
a145d2602f
  1. 8
      apps/api/src/services/tag/tag.service.ts

8
apps/api/src/services/tag/tag.service.ts

@ -23,7 +23,11 @@ export class TagService {
name: 'asc' name: 'asc'
}, },
include: { include: {
_count: {
select: {
orders: true orders: true
}
}
}, },
where: { where: {
OR: [ OR: [
@ -39,8 +43,8 @@ export class TagService {
return tags.map((tag) => ({ return tags.map((tag) => ({
...tag, ...tag,
isUsed: tag.orders.length > 0, isUsed: tag._count.orders > 0,
orders: undefined _count: undefined
})); }));
} }
} }

Loading…
Cancel
Save