Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

make customer/count groupBy aware

Steven Tey285b36c07550
diff --git a/apps/web/app/(ee)/api/customers/count/route.ts b/apps/web/app/(ee)/api/customers/count/route.ts
index 10544a6270..4a3fff2a9a 100644
--- a/apps/web/app/(ee)/api/customers/count/route.ts
+++ b/apps/web/app/(ee)/api/customers/count/route.ts
@@ -23,12 +23,16 @@ export const GET = withWorkspace(async ({ workspace, searchParams }) => {
{ name: { startsWith: search } },
],
}),
- ...(country && {
- country,
- }),
- ...(linkId && {
- linkId,
- }),
+ // only filter by country if not grouping by country
+ ...(country &&
+ groupBy !== "country" && {
+ country,
+ }),
+ // only filter by linkId if not grouping by linkId
+ ...(linkId &&
+ groupBy !== "linkId" && {
+ linkId,
+ }),
}),
};