Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Jan 31, 2025
1 parent ba98ef6 commit 91c839f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/web/app/api/embed/analytics/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions apps/web/lib/zod/schemas/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
22 changes: 22 additions & 0 deletions apps/web/scripts/backfill-link-partner-ids.ts
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit 91c839f

Please sign in to comment.