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.

remove tags

Kiran Kf27bde30882c
diff --git a/apps/web/app/api/cron/domains/transfer/route.ts b/apps/web/app/api/cron/domains/transfer/route.ts
index e94176657e..fa64e72762 100644
--- a/apps/web/app/api/cron/domains/transfer/route.ts
+++ b/apps/web/app/api/cron/domains/transfer/route.ts
@@ -133,6 +133,10 @@ export async function POST(req: Request) {
where: { domain, projectId: currentWorkspaceId, id: { in: linkIds } },
data: { projectId: newWorkspaceId },
}),
+ prisma.linkTag.deleteMany({
+ where: { linkId: { in: linkIds } },
+ }),
+ updateLinksInRedis(links),
setRootDomain({
id: domainRecord.id,
domain,
@@ -143,7 +147,6 @@ export async function POST(req: Request) {
}),
rewrite: domainRecord.type === "rewrite",
}),
- updateLinksInRedis(links),
updateAnalytics(links),
]);
@@ -173,6 +176,5 @@ export async function POST(req: Request) {
// TODO:
// Update TB
- // Clear tags when transferring link
// Send email
}
diff --git a/apps/web/app/api/domains/[domain]/transfer/route.ts b/apps/web/app/api/domains/[domain]/transfer/route.ts
index cc5bb9945c..bc1a0ae051 100644
--- a/apps/web/app/api/domains/[domain]/transfer/route.ts
+++ b/apps/web/app/api/domains/[domain]/transfer/route.ts
@@ -66,83 +66,6 @@ export const POST = withAuth(
});
return NextResponse.json({}, { headers });
-
- // const link = await prisma.link.findUnique({
- // where: {
- // id: params.linkId,
- // },
- // include: {
- // tags: true,
- // },
- // });
-
- // if (newWorkspace.linksUsage >= newWorkspace.linksLimit) {
- // throw new DubApiError({
- // code: "forbidden",
- // message: "New workspace has reached its link limit.",
- // });
- // }
-
- // const linkClicks = await getAnalytics({
- // linkId: link.id,
- // endpoint: "clicks",
- // interval: "30d",
- // });
-
- // const response = await Promise.all([
- // prisma.link.update({
- // where: {
- // id: link.id,
- // },
- // data: {
- // projectId: newWorkspaceId,
- // // remove tags when transferring link
- // tags: {
- // deleteMany: {},
- // },
- // },
- // }),
- // redis.hset(link.domain, {
- // [link.key.toLowerCase()]: await formatRedisLink({
- // ...link,
- // projectId: newWorkspaceId,
- // }),
- // }),
- // recordLink({
- // link: {
- // ...link,
- // projectId: newWorkspaceId,
- // },
- // }),
- // // decrement old workspace usage
- // prisma.project.update({
- // where: {
- // id: workspace.id,
- // },
- // data: {
- // usage: {
- // decrement: linkClicks,
- // },
- // linksUsage: {
- // decrement: 1,
- // },
- // },
- // }),
- // // increment new workspace usage
- // prisma.project.update({
- // where: {
- // id: newWorkspaceId,
- // },
- // data: {
- // usage: {
- // increment: linkClicks,
- // },
- // linksUsage: {
- // increment: 1,
- // },
- // },
- // }),
- // ]);
},
{ requiredRole: ["owner"] },
);