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 excludeRoot option to API calls

Kiran K881014b68777
diff --git a/apps/web/app/api/cron/links/event/route.ts b/apps/web/app/api/cron/links/event/route.ts
index 2b04926d4c..b04cfc5583 100644
--- a/apps/web/app/api/cron/links/event/route.ts
+++ b/apps/web/app/api/cron/links/event/route.ts
@@ -143,6 +143,7 @@ export async function POST(req: Request) {
linkId,
endpoint: "clicks",
interval: "30d",
+ excludeRoot: false,
});
// update old and new project usage
diff --git a/apps/web/app/api/cron/usage/utils.ts b/apps/web/app/api/cron/usage/utils.ts
index 9f8931c114..6fce770991 100644
--- a/apps/web/app/api/cron/usage/utils.ts
+++ b/apps/web/app/api/cron/usage/utils.ts
@@ -124,7 +124,7 @@ export const updateUsage = async (skip?: number) => {
projectId: project.id,
endpoint: "top_links",
interval: "30d",
- excludeRoot: "true",
+ excludeRoot: true,
}).then(async (data) => {
const topFive = data.slice(0, 5);
return await Promise.all(
diff --git a/apps/web/app/api/og/analytics/route.tsx b/apps/web/app/api/og/analytics/route.tsx
index 3fa90f34b8..1461c9ea89 100644
--- a/apps/web/app/api/og/analytics/route.tsx
+++ b/apps/web/app/api/og/analytics/route.tsx
@@ -36,6 +36,7 @@ export async function GET(req: NextRequest) {
linkId: link.id,
endpoint: "timeseries",
interval: "30d",
+ excludeRoot: false
});
const maxClicks = Math.max(...timeseries.map((t) => t.clicks));
diff --git a/apps/web/lib/analytics.ts b/apps/web/lib/analytics.ts
index 278d9ae538..836e4a4542 100644
--- a/apps/web/lib/analytics.ts
+++ b/apps/web/lib/analytics.ts
@@ -98,7 +98,7 @@ export const getAnalytics = async ({
endpoint,
interval,
...rest
-}: z.infer<typeof getAnalyticsQuerySchema> & {
+}: Omit<z.infer<typeof getAnalyticsQuerySchema>, "projectSlug"> & {
projectId?: string;
linkId?: string;
endpoint: (typeof VALID_TINYBIRD_ENDPOINTS)[number];
diff --git a/apps/web/scripts/download-top-links.ts b/apps/web/scripts/download-top-links.ts
index 50f55f8f39..0417bfbb6f 100644
--- a/apps/web/scripts/download-top-links.ts
+++ b/apps/web/scripts/download-top-links.ts
@@ -10,7 +10,7 @@ async function main() {
projectId: "xxx",
endpoint: "top_links",
interval: "30d",
- excludeRoot: "true",
+ excludeRoot: true,
}).then(async (data) => {
return await Promise.all(
data.map(
diff --git a/apps/web/scripts/get-top-links-for-project.ts b/apps/web/scripts/get-top-links-for-project.ts
index acbc587e45..66bcb368b4 100644
--- a/apps/web/scripts/get-top-links-for-project.ts
+++ b/apps/web/scripts/get-top-links-for-project.ts
@@ -38,7 +38,7 @@ async function main() {
projectId: project.id,
endpoint: "top_links",
interval: "30d",
- excludeRoot: "true",
+ excludeRoot: true,
}).then(async (data) => {
const topFive = data.slice(0, 5);
return await Promise.all(