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.

recordLink deleted for workspace transfers

Steven Teyb918f588983a
diff --git a/apps/web/app/(ee)/api/cron/domains/transfer/route.ts b/apps/web/app/(ee)/api/cron/domains/transfer/route.ts
index 021e0fa92f..8d0c45949f 100644
--- a/apps/web/app/(ee)/api/cron/domains/transfer/route.ts
+++ b/apps/web/app/(ee)/api/cron/domains/transfer/route.ts
@@ -89,6 +89,10 @@ export async function POST(req: Request) {
where: { linkId: { in: linkIds } },
}),
+ // set the links with the old workspace ID to be deleted in Tinybird
+ recordLink(links, { deleted: true }),
+
+ // set the links with the new workspace ID to be created in Tinybird
recordLink(
links.map((link) => ({
...link,
diff --git a/apps/web/app/api/links/[linkId]/transfer/route.ts b/apps/web/app/api/links/[linkId]/transfer/route.ts
index e9dc5e8649..a8e5a728ad 100644
--- a/apps/web/app/api/links/[linkId]/transfer/route.ts
+++ b/apps/web/app/api/links/[linkId]/transfer/route.ts
@@ -108,6 +108,9 @@ export const POST = withWorkspace(
Promise.all([
linkCache.set(updatedLink),
+ // set the link with the old workspace ID to be deleted in Tinybird
+ recordLink(link, { deleted: true }),
+ // set the link with the new workspace ID to be created in Tinybird
recordLink(updatedLink),
// Remove the webhooks associated with the link