The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
include userId for link imports
Steven Tey8ef0fc862ee9
diff --git a/apps/web/app/api/cron/import/bitly/utils.ts b/apps/web/app/api/cron/import/bitly/utils.tsindex e1836a870b..2d46fc72a9 100644--- a/apps/web/app/api/cron/import/bitly/utils.ts+++ b/apps/web/app/api/cron/import/bitly/utils.ts@@ -7,6 +7,7 @@ import LinksImported from "emails/links-imported";// rate limit for /groups/{group_guid}/bitlinks is 1500 per hour or 150 per minuteexport const importLinksFromBitly = async ({projectId,+ userId,bitlyGroup,domains,tagsToId,@@ -15,6 +16,7 @@ export const importLinksFromBitly = async ({count = 0,}: {projectId: string;+ userId: string;bitlyGroup: string;domains: string[];tagsToId?: Record<string, string>;@@ -54,6 +56,7 @@ export const importLinksFromBitly = async ({const tagId = tagsToId ? tagsToId[tags[0]] : null;return {projectId,+ userId,domain,key,url,@@ -159,6 +162,7 @@ export const importLinksFromBitly = async ({} else {return await importLinksFromBitly({projectId,+ userId,domains,bitlyGroup,bitlyApiKey,diff --git a/apps/web/app/api/cron/import/short/route.ts b/apps/web/app/api/cron/import/short/route.tsindex 7064afb558..31d7ac2792 100644--- a/apps/web/app/api/cron/import/short/route.ts+++ b/apps/web/app/api/cron/import/short/route.ts@@ -19,12 +19,13 @@ export async function POST(req: Request) {}try {- const { projectId, domainId, domain } = body;+ const { projectId, userId, domainId, domain } = body;const shortApiKey = (await redis.get(`import:short:${projectId}`,)) as string;await importLinksFromShort({projectId,+ userId,domainId,domain,shortApiKey,diff --git a/apps/web/app/api/cron/import/short/utils.ts b/apps/web/app/api/cron/import/short/utils.tsindex 68c91a226f..8c20155e06 100644--- a/apps/web/app/api/cron/import/short/utils.ts+++ b/apps/web/app/api/cron/import/short/utils.ts@@ -6,6 +6,7 @@ import LinksImported from "emails/links-imported";// recursive function to check if nextPageToken is not null, else breakexport const importLinksFromShort = async ({projectId,+ userId,domainId,domain,shortApiKey,@@ -13,6 +14,7 @@ export const importLinksFromShort = async ({count = 0,}: {projectId: string;+ userId: string;domainId: number;domain: string;shortApiKey: string;@@ -63,6 +65,7 @@ export const importLinksFromShort = async ({);return {projectId,+ userId,domain,key: path,url: originalURL,@@ -157,6 +160,7 @@ export const importLinksFromShort = async ({} else {return await importLinksFromShort({projectId,+ userId,domainId,domain,shortApiKey,diff --git a/apps/web/app/api/projects/[slug]/import/bitly/route.ts b/apps/web/app/api/projects/[slug]/import/bitly/route.tsindex dc4d85c24f..99ac799fb7 100644--- a/apps/web/app/api/projects/[slug]/import/bitly/route.ts+++ b/apps/web/app/api/projects/[slug]/import/bitly/route.ts@@ -49,7 +49,7 @@ export const GET = withAuth(async ({ project }) => {});// POST /api/projects/[slug]/import/bitly - create job to import links from bitly-export const POST = withAuth(async ({ req, project }) => {+export const POST = withAuth(async ({ req, project, session }) => {const { selectedDomains, selectedGroupTags } = await req.json();// check if there are domains that are not in the project@@ -97,6 +97,7 @@ export const POST = withAuth(async ({ req, project }) => {url: `${APP_DOMAIN_WITH_NGROK}/api/cron/import/bitly`,body: {projectId: project.id,+ userId: session?.user?.id,bitlyGroup,domains,keepTags,diff --git a/apps/web/app/api/projects/[slug]/import/short/route.ts b/apps/web/app/api/projects/[slug]/import/short/route.tsindex 096033c41e..3f624beb32 100644--- a/apps/web/app/api/projects/[slug]/import/short/route.ts+++ b/apps/web/app/api/projects/[slug]/import/short/route.ts@@ -55,7 +55,7 @@ export const PUT = withAuth(async ({ req, project }) => {});// POST /api/projects/[slug]/import/short - create job to import links from Short.io-export const POST = withAuth(async ({ req, project }) => {+export const POST = withAuth(async ({ req, project, session }) => {const { selectedDomains } = await req.json();// check if there are domains that are not in the project@@ -85,6 +85,7 @@ export const POST = withAuth(async ({ req, project }) => {url: `${APP_DOMAIN_WITH_NGROK}/api/cron/import/short`,body: {projectId: project.id,+ userId: session?.user?.id,domainId: id,domain,},