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.

add tagNames to links count api

Kiran K17a278bb06f1
diff --git a/apps/web/lib/api/links/get-links-count.ts b/apps/web/lib/api/links/get-links-count.ts
index 646a05e13d..e48b3f1261 100644
--- a/apps/web/lib/api/links/get-links-count.ts
+++ b/apps/web/lib/api/links/get-links-count.ts
@@ -12,8 +12,16 @@ export async function getLinksCount({
workspaceId: string;
userId?: string | null;
}) {
- const { groupBy, search, domain, tagId, tagIds, showArchived, withTags } =
- searchParams;
+ const {
+ groupBy,
+ search,
+ domain,
+ tagId,
+ tagIds,
+ tagNames,
+ showArchived,
+ withTags,
+ } = searchParams;
const combinedTagIds = combineTagIds({ tagId, tagIds });
@@ -59,16 +67,23 @@ export async function getLinksCount({
some: {},
},
}),
- ...(combinedTagIds &&
- combinedTagIds.length > 0 && {
- tags: {
- some: {
- tagId: {
- in: tagIds,
+ ...(combinedTagIds && combinedTagIds.length > 0
+ ? {
+ tags: { some: { tagId: { in: combinedTagIds } } },
+ }
+ : tagNames
+ ? {
+ tags: {
+ some: {
+ tag: {
+ name: {
+ in: tagNames,
+ },
+ },
+ },
},
- },
- },
- }),
+ }
+ : {}),
};
if (groupBy === "domain") {