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.

remove allowedFolderIds from analytics and events

Kiran Kde1d49ed1e0a
diff --git a/apps/web/app/api/analytics/export/route.ts b/apps/web/app/api/analytics/export/route.ts
index fbd31b83b1..7fe28c73b7 100644
--- a/apps/web/app/api/analytics/export/route.ts
+++ b/apps/web/app/api/analytics/export/route.ts
@@ -90,7 +90,6 @@ export const GET = withWorkspace(
...(link && { linkId: link.id }),
event: "clicks",
groupBy: endpoint,
- allowedFolderIds: folders.map((folder) => folder.id),
});
if (!response || response.length === 0) return;
diff --git a/apps/web/app/api/analytics/route.ts b/apps/web/app/api/analytics/route.ts
index b61695808b..ab0f567124 100644
--- a/apps/web/app/api/analytics/route.ts
+++ b/apps/web/app/api/analytics/route.ts
@@ -114,7 +114,6 @@ export const GET = withWorkspace(
...(link && { linkId: link.id }),
workspaceId: workspace.id,
isDeprecatedClicksEndpoint,
- allowedFolderIds: folders.map((folder) => folder.id),
});
return NextResponse.json(response);
diff --git a/apps/web/app/api/events/export/route.ts b/apps/web/app/api/events/export/route.ts
index a40191be80..2b3c75e6e0 100644
--- a/apps/web/app/api/events/export/route.ts
+++ b/apps/web/app/api/events/export/route.ts
@@ -103,7 +103,6 @@ export const GET = withWorkspace(
...(link && { linkId: link.id }),
workspaceId: workspace.id,
limit: 100000,
- allowedFolderIds: folders.map((folder) => folder.id),
});
const data = response.map((row) =>
diff --git a/apps/web/app/api/events/route.ts b/apps/web/app/api/events/route.ts
index 5ecb2d7ae5..e1798f954f 100644
--- a/apps/web/app/api/events/route.ts
+++ b/apps/web/app/api/events/route.ts
@@ -86,7 +86,6 @@ export const GET = withWorkspace(
event,
...(link && { linkId: link.id }),
workspaceId: workspace.id,
- allowedFolderIds: folders.map((folder) => folder.id),
});
return NextResponse.json(response);
diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.ts
index 3fb3b605e8..dd265ad3dd 100644
--- a/apps/web/lib/analytics/get-analytics.ts
+++ b/apps/web/lib/analytics/get-analytics.ts
@@ -29,14 +29,9 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
timezone = "UTC",
isDemo,
isDeprecatedClicksEndpoint = false,
- allowedFolderIds,
folderId,
} = params;
- if (folderId) {
- allowedFolderIds = [folderId];
- }
-
const tagIds = combineTagIds(params);
// get all-time clicks count if:
@@ -102,7 +97,7 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
eventType: event,
workspaceId,
tagIds,
- folderIds: allowedFolderIds,
+ folderId: folderId || "",
qr,
start: startDate.toISOString().replace("T", " ").replace("Z", ""),
end: endDate.toISOString().replace("T", " ").replace("Z", ""),
@@ -131,12 +126,7 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
id: {
in: topLinksData.map((item) => item.link),
},
-
- // This might be unnecessary because links are filtered by folderIds in the Tinybird pipe
- // Remove after making sure TB works as expected
- AND: {
- OR: [{ folderId: { in: allowedFolderIds } }, { folderId: null }],
- },
+ folderId: folderId || "",
},
select: {
id: true,
diff --git a/apps/web/lib/analytics/types.ts b/apps/web/lib/analytics/types.ts
index 09255dcdc1..1c98e40faf 100644
--- a/apps/web/lib/analytics/types.ts
+++ b/apps/web/lib/analytics/types.ts
@@ -33,7 +33,6 @@ export type AnalyticsFilters = z.infer<typeof analyticsQuerySchema> & {
workspaceId?: string;
isDemo?: boolean;
isDeprecatedClicksEndpoint?: boolean;
- allowedFolderIds?: string[];
programId?: string;
};
@@ -41,7 +40,6 @@ export type EventsFilters = z.infer<typeof eventsQuerySchema> & {
workspaceId?: string;
isDemo?: boolean;
obfuscateData?: boolean;
- allowedFolderIds?: string[];
customerId?: string;
};