Skip to content

Commit 285b36c

Browse files
committed
make customer/count groupBy aware
1 parent 125f8a5 commit 285b36c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

  • apps/web/app/(ee)/api/customers/count

apps/web/app/(ee)/api/customers/count/route.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ export const GET = withWorkspace(async ({ workspace, searchParams }) => {
2323
{ name: { startsWith: search } },
2424
],
2525
}),
26-
...(country && {
27-
country,
28-
}),
29-
...(linkId && {
30-
linkId,
31-
}),
26+
// only filter by country if not grouping by country
27+
...(country &&
28+
groupBy !== "country" && {
29+
country,
30+
}),
31+
// only filter by linkId if not grouping by linkId
32+
...(linkId &&
33+
groupBy !== "linkId" && {
34+
linkId,
35+
}),
3236
}),
3337
};
3438

0 commit comments

Comments
 (0)