The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Skip schema check when includeUser present
Kiran Kaa24467b0b41
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.tsindex 2785eb64d7..b46f349db2 100644--- a/apps/web/app/api/links/route.ts+++ b/apps/web/app/api/links/route.ts@@ -8,14 +8,9 @@ import {createLinkBodySchema,getLinksQuerySchemaExtended,} from "@/lib/zod/schemas";-import { UserSchema } from "@/lib/zod/schemas/users";import { LOCALHOST_IP, getSearchParamsWithArray } from "@dub/utils";import { NextResponse } from "next/server";-const LinkSchemaWithUser = LinkSchemaExtended.extend({- user: UserSchema.nullable(),-});-// GET /api/links – get all links for a workspaceexport const GET = withWorkspace(async ({ req, headers, workspace }) => {const searchParams = getSearchParamsWithArray(req.url);@@ -47,9 +42,9 @@ export const GET = withWorkspace(async ({ req, headers, workspace }) => {includeUser,});- const links = (includeUser ? LinkSchemaWithUser : LinkSchemaExtended)- .array()- .parse(response);+ const links = includeUser+ ? response+ : LinkSchemaExtended.array().parse(response);return NextResponse.json(links, {headers,diff --git a/apps/web/lib/zod/schemas/users.ts b/apps/web/lib/zod/schemas/users.tsdeleted file mode 100644index a9d0cb99a0..0000000000--- a/apps/web/lib/zod/schemas/users.ts+++ /dev/null@@ -1,11 +0,0 @@-import z from "@/lib/zod";--export const UserSchema = z.object({- id: z.string(),- name: z.string(),- email: z.string(),- // emailVerified: z.string().nullable(),- image: z.string().nullable(),- subscribed: z.boolean().nullable(),- source: z.string().nullable(),-});