The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update schemas
Tim Wilson17097edfc9c9
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.tsindex f8a264c515..3a02cbf031 100644--- a/apps/web/lib/zod/schemas/links.ts+++ b/apps/web/lib/zod/schemas/links.ts@@ -25,6 +25,16 @@ export const getDomainQuerySchema = z.object({.refine((v) => validDomainRegex.test(v), { message: "Invalid domain" }),});+export const LinkTestsSchema = z+ .array(+ z.object({+ url: z.string(),+ percentage: z.number().min(0).max(100),+ }),+ )+ .nullish()+ .describe("An array of A/B test URLs and their percentages");+const LinksQuerySchema = z.object({domain: z.string()@@ -384,6 +394,7 @@ export const createLinkBodySchema = z.object({.describe("An array of webhook IDs to trigger when the link is clicked. These webhooks will receive click event data.",),+ tests: LinkTestsSchema,});export const updateLinkBodySchema = createLinkBodySchema.partial();@@ -600,6 +611,7 @@ export const LinkSchema = z.string().nullable().describe("The UTM content of the short link."),+ tests: LinkTestsSchema,userId: z.string().nullable()diff --git a/packages/prisma/schema/link.prisma b/packages/prisma/schema/link.prismaindex 2d556eb8c4..837cf26c10 100644--- a/packages/prisma/schema/link.prisma+++ b/packages/prisma/schema/link.prisma@@ -33,6 +33,10 @@ model Link {android String? @db.LongText // custom link for Android devicesgeo Json? @db.Json // custom link for specific countries+ // A/B Testing+ tests Json? @db.Json // A/B testing data+ testsCompleteAt DateTime? // When tests were or will be completed+// User who created the linkuser User? @relation(fields: [userId], references: [id])userId String?