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.

format

Kiran Kc03689ffe022
diff --git a/apps/web/app/api/analytics/events/export/route.ts b/apps/web/app/api/analytics/events/export/route.ts
index 1fa23d98dd..6a6496d70b 100644
--- a/apps/web/app/api/analytics/events/export/route.ts
+++ b/apps/web/app/api/analytics/events/export/route.ts
@@ -39,10 +39,7 @@ const columnAccessors = {
// GET /api/analytics/events/export – get export data for analytics
export const GET = withWorkspace(
async ({ searchParams, workspace, link, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["analytics.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["analytics.read"] });
const parsedParams = eventsQuerySchema
.and(
diff --git a/apps/web/app/api/analytics/events/route.ts b/apps/web/app/api/analytics/events/route.ts
index 9c25898540..5febb32cc9 100644
--- a/apps/web/app/api/analytics/events/route.ts
+++ b/apps/web/app/api/analytics/events/route.ts
@@ -8,10 +8,7 @@ import { NextResponse } from "next/server";
export const GET = withWorkspace(
async ({ searchParams, workspace, link, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["analytics.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["analytics.read"] });
const parsedParams = eventsQuerySchema.parse(searchParams);
diff --git a/apps/web/app/api/analytics/export/route.ts b/apps/web/app/api/analytics/export/route.ts
index 03bd350666..e6c1b3499d 100644
--- a/apps/web/app/api/analytics/export/route.ts
+++ b/apps/web/app/api/analytics/export/route.ts
@@ -10,10 +10,7 @@ import JSZip from "jszip";
// GET /api/analytics/[endpoint]/export – get export data for analytics
export const GET = withWorkspace(
async ({ searchParams, workspace, link, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["analytics.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["analytics.read"] });
const parsedParams = analyticsQuerySchema.parse(searchParams);
const { domain, key, interval, start, end } = parsedParams;
diff --git a/apps/web/app/api/analytics/public-stats/route.ts b/apps/web/app/api/analytics/public-stats/route.ts
index 34eb97ffea..8bd83add84 100644
--- a/apps/web/app/api/analytics/public-stats/route.ts
+++ b/apps/web/app/api/analytics/public-stats/route.ts
@@ -12,10 +12,7 @@ const updatePublicStatsSchema = z.object({
// GET /api/analytics – get the publicStats setting for a link
export const GET = withWorkspace(async ({ searchParams, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["links.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["links.read"] });
const { domain, key } = domainKeySchema.parse(searchParams);
const response = await getDomainOrLink({ domain, key });
@@ -24,10 +21,7 @@ export const GET = withWorkspace(async ({ searchParams, scopes }) => {
// PUT /api/analytics – update the publicStats setting for a link
export const PUT = withWorkspace(async ({ req, searchParams, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["links.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["links.write"] });
const { domain, key } = domainKeySchema.parse(searchParams);
const { publicStats } = updatePublicStatsSchema.parse(await req.json());
diff --git a/apps/web/app/api/analytics/route.ts b/apps/web/app/api/analytics/route.ts
index e79d095068..899adeacb1 100644
--- a/apps/web/app/api/analytics/route.ts
+++ b/apps/web/app/api/analytics/route.ts
@@ -13,10 +13,7 @@ import { NextResponse } from "next/server";
// GET /api/analytics – get analytics
export const GET = withWorkspace(
async ({ params, searchParams, workspace, link, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["analytics.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["analytics.read"] });
let { eventType: oldEvent, endpoint: oldType } =
analyticsPathParamsSchema.parse(params);
diff --git a/apps/web/app/api/domains/[domain]/primary/route.ts b/apps/web/app/api/domains/[domain]/primary/route.ts
index 9ef0e48bc0..72d9f7cb50 100644
--- a/apps/web/app/api/domains/[domain]/primary/route.ts
+++ b/apps/web/app/api/domains/[domain]/primary/route.ts
@@ -7,10 +7,7 @@ import { NextResponse } from "next/server";
// POST /api/domains/[domain]/primary – set a domain as primary
export const POST = withWorkspace(
async ({ headers, workspace, domain, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const responses = await Promise.all([
prisma.domain.update({
diff --git a/apps/web/app/api/domains/[domain]/route.ts b/apps/web/app/api/domains/[domain]/route.ts
index 2ab54c3599..51a54dafd3 100644
--- a/apps/web/app/api/domains/[domain]/route.ts
+++ b/apps/web/app/api/domains/[domain]/route.ts
@@ -20,10 +20,7 @@ import { NextResponse } from "next/server";
// GET /api/domains/[domain] – get a workspace's domain
export const GET = withWorkspace(
async ({ domain, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.read"] });
const data = await prisma.domain.findUnique({
where: {
@@ -62,10 +59,7 @@ export const GET = withWorkspace(
// PUT /api/domains/[domain] – edit a workspace's domain
export const PATCH = withWorkspace(
async ({ req, workspace, domain, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const body = await parseRequestBody(req);
const {
@@ -146,10 +140,7 @@ export const PATCH = withWorkspace(
// DELETE /api/domains/[domain] - delete a workspace's domain
export const DELETE = withWorkspace(
async ({ domain, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
await deleteDomainAndLinks(domain);
return NextResponse.json({ slug: domain });
diff --git a/apps/web/app/api/domains/[domain]/transfer/route.ts b/apps/web/app/api/domains/[domain]/transfer/route.ts
index 3e50048b49..3a51177453 100644
--- a/apps/web/app/api/domains/[domain]/transfer/route.ts
+++ b/apps/web/app/api/domains/[domain]/transfer/route.ts
@@ -15,10 +15,7 @@ import { NextResponse } from "next/server";
// POST /api/domains/[domain]/transfer – transfer a domain to another workspace
export const POST = withWorkspace(
async ({ req, headers, session, params, workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const { domain } = params;
const { newWorkspaceId } = transferDomainBodySchema.parse(await req.json());
diff --git a/apps/web/app/api/domains/[domain]/verify/route.ts b/apps/web/app/api/domains/[domain]/verify/route.ts
index e4a12de433..c04c44e032 100644
--- a/apps/web/app/api/domains/[domain]/verify/route.ts
+++ b/apps/web/app/api/domains/[domain]/verify/route.ts
@@ -13,10 +13,7 @@ export const maxDuration = 30;
// GET /api/domains/[domain]/verify - get domain verification status
export const GET = withWorkspace(async ({ domain, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
let status: DomainVerificationStatusProps = "Valid Configuration";
diff --git a/apps/web/app/api/domains/default/route.ts b/apps/web/app/api/domains/default/route.ts
index fc94144848..07f7129104 100644
--- a/apps/web/app/api/domains/default/route.ts
+++ b/apps/web/app/api/domains/default/route.ts
@@ -7,10 +7,7 @@ import { NextResponse } from "next/server";
// GET /api/domains/default - get default domains
export const GET = withWorkspace(async ({ workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const defaultDomains = await prisma.defaultDomains.findUnique({
where: {
@@ -45,10 +42,7 @@ const updateDefaultDomainsSchema = z.object({
// PUT /api/domains/default - edit default domains
export const PUT = withWorkspace(async ({ req, workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const { defaultDomains } = await updateDefaultDomainsSchema.parseAsync(
await req.json(),
diff --git a/apps/web/app/api/domains/route.ts b/apps/web/app/api/domains/route.ts
index 0dabec86be..96f1a374f6 100644
--- a/apps/web/app/api/domains/route.ts
+++ b/apps/web/app/api/domains/route.ts
@@ -15,10 +15,7 @@ import { NextResponse } from "next/server";
// GET /api/domains – get all domains for a workspace
export const GET = withWorkspace(async ({ workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.read"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.read"] });
const domains = await prisma.domain.findMany({
where: {
@@ -31,10 +28,7 @@ export const GET = withWorkspace(async ({ workspace, scopes }) => {
// POST /api/domains - add a domain
export const POST = withWorkspace(async ({ req, workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["domains.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["domains.write"] });
const body = await parseRequestBody(req);
const {
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index 842661eecf..f1bd8879c2 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -14,10 +14,7 @@ import { NextResponse } from "next/server";
// GET /api/links – get all links for a workspace
export const GET = withWorkspace(
async ({ req, headers, workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["links.read", "links.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["links.read", "links.write"] });
const searchParams = getSearchParamsWithArray(req.url);
@@ -57,10 +54,7 @@ export const GET = withWorkspace(
// POST /api/links – create a new link
export const POST = withWorkspace(
async ({ req, headers, session, workspace, scopes }) => {
- throwIfNoAccess({
- scopes,
- requiredAnyOf: ["links.write"],
- });
+ throwIfNoAccess({ scopes, requiredAnyOf: ["links.write"] });
const bodyRaw = await parseRequestBody(req);
const body = createLinkBodySchema.parse(bodyRaw);