The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix: remove webhoo link during domain transfer
Kiran K2b8298e4ba6d
diff --git a/apps/web/app/api/cron/domains/transfer/route.ts b/apps/web/app/api/cron/domains/transfer/route.tsindex ca9809fd06..4bcb9f28f9 100644--- a/apps/web/app/api/cron/domains/transfer/route.ts+++ b/apps/web/app/api/cron/domains/transfer/route.ts@@ -27,13 +27,6 @@ export async function POST(req: Request) {const links = await prisma.link.findMany({where: { domain, projectId: currentWorkspaceId },take: 100,- include: {- webhooks: {- select: {- webhookId: true,- },- },- },});// No remaining links to transfer@@ -55,7 +48,11 @@ export async function POST(req: Request) {await Promise.all([prisma.link.updateMany({- where: { domain, projectId: currentWorkspaceId, id: { in: linkIds } },+ where: {+ domain,+ projectId: currentWorkspaceId,+ id: { in: linkIds },+ },data: { projectId: newWorkspaceId },}),@@ -63,20 +60,13 @@ export async function POST(req: Request) {where: { linkId: { in: linkIds } },}),+ updateLinksInRedis({ links, newWorkspaceId, domain }),+// Remove the webhooks associated with the linksprisma.linkWebhook.deleteMany({where: { linkId: { in: linkIds } },}),- updateLinksInRedis({- links: links.map((link) => ({- ...link,- webhookIds: link.webhooks.map(({ webhookId }) => webhookId),- })),- newWorkspaceId,- domain,- }),-recordLink(links.map((link) => ({link_id: link.id,diff --git a/apps/web/app/api/cron/domains/transfer/utils.ts b/apps/web/app/api/cron/domains/transfer/utils.tsindex 80c73703af..2aa8f3710c 100644--- a/apps/web/app/api/cron/domains/transfer/utils.ts+++ b/apps/web/app/api/cron/domains/transfer/utils.ts@@ -12,7 +12,7 @@ export const updateLinksInRedis = async ({}: {newWorkspaceId: string;domain: string;- links: (Link & { webhookIds: string[] })[];+ links: Link[];}) => {const pipeline = redis.pipeline();