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.

filter these out program links from dashboard

Kiran K63e7b6fab85b
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index 167c73e670..b7e3600b55 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -35,6 +35,7 @@ export const GET = withWorkspace(
includeWebhooks,
includeDashboard,
linkIds,
+ showProgramLinks,
} = getLinksQuerySchemaExtended.parse(searchParams);
if (domain) {
@@ -57,6 +58,7 @@ export const GET = withWorkspace(
includeWebhooks,
includeDashboard,
linkIds,
+ showProgramLinks,
});
return NextResponse.json(response, {
diff --git a/apps/web/lib/api/links/get-links-count.ts b/apps/web/lib/api/links/get-links-count.ts
index 520977444f..1f0bd14037 100644
--- a/apps/web/lib/api/links/get-links-count.ts
+++ b/apps/web/lib/api/links/get-links-count.ts
@@ -21,6 +21,7 @@ export async function getLinksCount({
userId,
showArchived,
withTags,
+ showProgramLinks,
} = searchParams;
const combinedTagIds = combineTagIds({ tagId, tagIds });
@@ -48,6 +49,7 @@ export async function getLinksCount({
groupBy !== "userId" && {
userId,
}),
+ ...(!showProgramLinks && { programId: null }),
};
if (groupBy === "tagId") {
diff --git a/apps/web/lib/api/links/get-links-for-workspace.ts b/apps/web/lib/api/links/get-links-for-workspace.ts
index bf0075eb64..72ba2b0175 100644
--- a/apps/web/lib/api/links/get-links-for-workspace.ts
+++ b/apps/web/lib/api/links/get-links-for-workspace.ts
@@ -21,6 +21,7 @@ export async function getLinksForWorkspace({
includeWebhooks,
includeDashboard,
linkIds,
+ showProgramLinks
}: z.infer<typeof getLinksQuerySchemaExtended> & {
workspaceId: string;
}) {
@@ -65,6 +66,7 @@ export async function getLinksForWorkspace({
: {}),
...(userId && { userId }),
...(linkIds && { id: { in: linkIds } }),
+ ...(!showProgramLinks && { programId: null }),
},
include: {
tags: {
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 7b450e4c02..5ea7bb0f87 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -90,6 +90,7 @@ export const getLinksCountQuerySchema = LinksQuerySchema.merge(
.union([z.literal("domain"), z.literal("tagId"), z.literal("userId")])
.optional()
.describe("The field to group the links by."),
+ showProgramLinks: booleanQuerySchema.optional().default("false"),
}),
);
@@ -600,6 +601,7 @@ export const getLinksQuerySchemaExtended = getLinksQuerySchema.merge(
.transform((v) => (Array.isArray(v) ? v : v.split(",")))
.optional()
.describe("Link IDs to filter by."),
+ showProgramLinks: booleanQuerySchema.optional().default("false"),
}),
);