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.

small changes

Steven Tey91c839f74668
diff --git a/apps/web/app/api/embed/analytics/route.ts b/apps/web/app/api/embed/analytics/route.ts
index c22b039a14..68006e9cf2 100644
--- a/apps/web/app/api/embed/analytics/route.ts
+++ b/apps/web/app/api/embed/analytics/route.ts
@@ -2,7 +2,7 @@ import { getAnalytics } from "@/lib/analytics/get-analytics";
import { withEmbedToken } from "@/lib/embed/auth";
import { NextResponse } from "next/server";
-// GET /api/embed/analytics – get timeseries analytics for a link from an embed token
+// GET /api/embed/analytics – get timeseries analytics for a partner
export const GET = withEmbedToken(async ({ programId, partnerId }) => {
const analytics = await getAnalytics({
event: "composite",
diff --git a/apps/web/lib/zod/schemas/analytics.ts b/apps/web/lib/zod/schemas/analytics.ts
index 23275441b0..18f7d01f92 100644
--- a/apps/web/lib/zod/schemas/analytics.ts
+++ b/apps/web/lib/zod/schemas/analytics.ts
@@ -217,6 +217,8 @@ export const analyticsFilterTB = z
}
}),
programId: z.string().optional(),
+ partnerId: z.string().optional(),
+ tenantId: z.string().optional(),
customerId: z.string().optional(),
root: z.boolean().optional(),
qr: z.boolean().optional(),
diff --git a/apps/web/scripts/backfill-link-partner-ids.ts b/apps/web/scripts/backfill-link-partner-ids.ts
new file mode 100644
index 0000000000..b042734483
--- /dev/null
+++ b/apps/web/scripts/backfill-link-partner-ids.ts
@@ -0,0 +1,22 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+import { includeTags } from "../lib/api/links/include-tags";
+import { recordLink } from "../lib/tinybird";
+
+// script to backfill tenantIds and partnerIds to dub_links_metadata in TB
+async function main() {
+ const links = await prisma.link.findMany({
+ where: {
+ partnerId: {
+ not: null,
+ },
+ },
+ include: includeTags,
+ });
+
+ console.log(links.length);
+
+ await recordLink(links);
+}
+
+main();