The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Refactor getLinks query schema to use base schema
Kiran K599a5062a0b6
diff --git a/apps/web/lib/openapi/links/get-links.ts b/apps/web/lib/openapi/links/get-links.tsindex be32f6e839..6130ff967b 100644--- a/apps/web/lib/openapi/links/get-links.ts+++ b/apps/web/lib/openapi/links/get-links.ts@@ -1,6 +1,6 @@import { openApiErrorResponses } from "@/lib/openapi/responses";import z from "@/lib/zod";-import { getLinksQuerySchema, LinkSchema } from "@/lib/zod/schemas/links";+import { getLinksQuerySchemaBase, LinkSchema } from "@/lib/zod/schemas/links";import { ZodOpenApiOperationObject } from "zod-openapi";export const getLinks: ZodOpenApiOperationObject = {@@ -28,7 +28,7 @@ export const getLinks: ZodOpenApiOperationObject = {description:"Retrieve a paginated list of links for the authenticated workspace.",requestParams: {- query: getLinksQuerySchema,+ query: getLinksQuerySchemaBase,},responses: {"200": {diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex 65099b7340..bb067ab3c2 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -84,7 +84,7 @@ const sortBy = z.default("createdAt").describe("The field to sort the links by. The default is `createdAt`.");-const getLinksQuerySchemaBase = LinksQuerySchema.merge(+export const getLinksQuerySchemaBase = LinksQuerySchema.merge(z.object({sortBy,sortOrder: z@@ -624,11 +624,6 @@ export const getLinksQuerySchemaExtended = getLinksQuerySchemaBase.merge(.describe("Link IDs to filter by."),}),);-// .transform((data) => ({-// ...data,-// // If sortBy is not provided but sort is, use sort value-// sortBy: data.sortBy === "createdAt" && data.sort ? data.sort : data.sortBy,-// }));export const linkEventSchema = LinkSchema.extend({// here we use string because url can be empty