The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
remove LinkSchemaExtended
Steven Tey0ddfa9494ed5
diff --git a/apps/web/app/api/links/[linkId]/route.ts b/apps/web/app/api/links/[linkId]/route.tsindex 4eb988136b..5cc48b2c7b 100644--- a/apps/web/app/api/links/[linkId]/route.ts+++ b/apps/web/app/api/links/[linkId]/route.ts@@ -8,7 +8,7 @@ import {import { withWorkspace } from "@/lib/auth";import prisma from "@/lib/prisma";import { NewLinkProps } from "@/lib/types";-import { LinkSchemaExtended, updateLinkBodySchema } from "@/lib/zod/schemas";+import { updateLinkBodySchema } from "@/lib/zod/schemas";import { NextResponse } from "next/server";// GET /api/links/[linkId] – get a link@@ -101,7 +101,7 @@ export const PUT = withWorkspace(async ({ req, headers, workspace, link }) => {updatedLink: processedLink,});- return NextResponse.json(LinkSchemaExtended.parse(response), {+ return NextResponse.json(response, {headers,});});diff --git a/apps/web/app/api/links/bulk/route.ts b/apps/web/app/api/links/bulk/route.tsindex 8d737f1838..d01a6b99b9 100644--- a/apps/web/app/api/links/bulk/route.ts+++ b/apps/web/app/api/links/bulk/route.ts@@ -3,10 +3,7 @@ import { bulkCreateLinks, combineTagIds, processLink } from "@/lib/api/links";import { withWorkspace } from "@/lib/auth";import prisma from "@/lib/prisma";import { ProcessedLinkProps } from "@/lib/types";-import {- LinkSchemaExtended,- bulkCreateLinksBodySchema,-} from "@/lib/zod/schemas";+import { bulkCreateLinksBodySchema } from "@/lib/zod/schemas";import { NextResponse } from "next/server";// POST /api/links/bulk – bulk create up to 100 links@@ -121,12 +118,9 @@ export const POST = withWorkspace(const validLinksResponse =validLinks.length > 0 ? await bulkCreateLinks({ links: validLinks }) : [];- return NextResponse.json(- [...LinkSchemaExtended.array().parse(validLinksResponse), ...errorLinks],- {- headers,- },- );+ return NextResponse.json([...validLinksResponse, ...errorLinks], {+ headers,+ });},{needNotExceededLinks: true,diff --git a/apps/web/app/api/links/info/route.ts b/apps/web/app/api/links/info/route.tsindex 7fcc0bc719..6a8c91f3e3 100644--- a/apps/web/app/api/links/info/route.ts+++ b/apps/web/app/api/links/info/route.ts@@ -2,7 +2,7 @@ import { DubApiError } from "@/lib/api/errors";import { LinkWithTags, transformLink } from "@/lib/api/links";import { withWorkspace } from "@/lib/auth";import prisma from "@/lib/prisma";-import { LinkSchemaExtended, getLinkInfoQuerySchema } from "@/lib/zod/schemas";+import { getLinkInfoQuerySchema } from "@/lib/zod/schemas";import { NextResponse } from "next/server";// GET /api/links/info – get the info for a link@@ -52,10 +52,7 @@ export const GET = withWorkspace(async ({ headers, searchParams, link }) => {? { ...link, ...tagsAndUser }: { ...link, tags: [] };- return NextResponse.json(- LinkSchemaExtended.parse(transformLink(linkWithTags)),- {- headers,- },- );+ return NextResponse.json(transformLink(linkWithTags), {+ headers,+ });});diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.tsindex b46f349db2..5161076098 100644--- a/apps/web/app/api/links/route.ts+++ b/apps/web/app/api/links/route.ts@@ -4,7 +4,6 @@ import { parseRequestBody } from "@/lib/api/utils";import { withWorkspace } from "@/lib/auth";import { ratelimit } from "@/lib/upstash";import {- LinkSchemaExtended,createLinkBodySchema,getLinksQuerySchemaExtended,} from "@/lib/zod/schemas";@@ -42,11 +41,7 @@ export const GET = withWorkspace(async ({ req, headers, workspace }) => {includeUser,});- const links = includeUser- ? response- : LinkSchemaExtended.array().parse(response);-- return NextResponse.json(links, {+ return NextResponse.json(response, {headers,});});@@ -85,7 +80,7 @@ export const POST = withWorkspace(const response = await createLink(link);- return NextResponse.json(LinkSchemaExtended.parse(response), { headers });+ return NextResponse.json(response, { headers });},{needNotExceededLinks: true,