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.

revert domainChecks

Kiran K8905471b6750
diff --git a/apps/web/app/api/domains/[domain]/primary/route.ts b/apps/web/app/api/domains/[domain]/primary/route.ts
index 20e4eb8ead..d30dbc3a68 100644
--- a/apps/web/app/api/domains/[domain]/primary/route.ts
+++ b/apps/web/app/api/domains/[domain]/primary/route.ts
@@ -36,6 +36,7 @@ export const POST = withWorkspace(
return NextResponse.json(DomainSchema.parse(domainRecord), { headers });
},
{
+ domainChecks: true,
requiredRole: ["owner"],
},
);
diff --git a/apps/web/app/api/domains/[domain]/route.ts b/apps/web/app/api/domains/[domain]/route.ts
index e0b49468a9..e9dedecd81 100644
--- a/apps/web/app/api/domains/[domain]/route.ts
+++ b/apps/web/app/api/domains/[domain]/route.ts
@@ -18,25 +18,30 @@ import { waitUntil } from "@vercel/functions";
import { NextResponse } from "next/server";
// GET /api/domains/[domain] – get a workspace's domain
-export const GET = withWorkspace(async ({ workspace, params }) => {
- const { domain } = params;
-
- const domainRecord = await prisma.domain.findUnique({
- where: {
- slug: domain,
- projectId: workspace.id,
- },
- });
-
- if (!domainRecord) {
- throw new DubApiError({
- code: "not_found",
- message: "Domain not found",
+export const GET = withWorkspace(
+ async ({ workspace, params }) => {
+ const { domain } = params;
+
+ const domainRecord = await prisma.domain.findUnique({
+ where: {
+ slug: domain,
+ projectId: workspace.id,
+ },
});
- }
- return NextResponse.json(DomainSchema.parse(domainRecord));
-});
+ if (!domainRecord) {
+ throw new DubApiError({
+ code: "not_found",
+ message: "Domain not found",
+ });
+ }
+
+ return NextResponse.json(DomainSchema.parse(domainRecord));
+ },
+ {
+ domainChecks: true,
+ },
+);
// PUT /api/domains/[domain] – edit a workspace's domain
export const PATCH = withWorkspace(
@@ -127,6 +132,7 @@ export const PATCH = withWorkspace(
return NextResponse.json(DomainSchema.parse(domainRecord));
},
{
+ domainChecks: true,
requiredRole: ["owner"],
},
);
@@ -141,6 +147,7 @@ export const DELETE = withWorkspace(
return NextResponse.json({ slug: domain });
},
{
+ domainChecks: true,
requiredRole: ["owner"],
},
);
diff --git a/apps/web/app/api/domains/[domain]/transfer/route.ts b/apps/web/app/api/domains/[domain]/transfer/route.ts
index 06f1e7573b..bef71ec552 100644
--- a/apps/web/app/api/domains/[domain]/transfer/route.ts
+++ b/apps/web/app/api/domains/[domain]/transfer/route.ts
@@ -132,5 +132,8 @@ export const POST = withWorkspace(
return NextResponse.json(DomainSchema.parse(domainResponse), { headers });
},
- { requiredRole: ["owner"] },
+ {
+ domainChecks: true,
+ requiredRole: ["owner"],
+ },
);