The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update route.ts
Kiran K0147c70d9443
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/events/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/events/route.tsindex f14a021dff..a840950cdf 100644--- a/apps/web/app/api/partner-profile/programs/[programId]/events/route.ts+++ b/apps/web/app/api/partner-profile/programs/[programId]/events/route.ts@@ -10,6 +10,13 @@ import { prisma } from "@dub/prisma";import { NextResponse } from "next/server";import { z } from "zod";+const CustomerSchema = z.object({+ id: z.string(),+ email: z+ .string()+ .transform((email) => email.replace(/(?<=^.).+(?=.@)/, "****")),+});+// GET /api/partner-profile/programs/[programId]/events – get events for a program enrollment linkexport const GET = withPartnerProfile(async ({ partner, params, searchParams }) => {@@ -49,24 +56,16 @@ export const GET = withPartnerProfile(const response = events.map((event) => {return {...event,- link: PartnerProfileLinkSchema.parse(event.link),+ link: event?.link ? PartnerProfileLinkSchema.parse(event.link) : null,// @ts-expect-error - customer is not always present...(event?.customer && {- customer: z- .object({- id: z.string(),- email: z- .string()- .transform((email) => email.replace(/(?<=^.).+(?=.@)/, "****")),- })+ customer: CustomerSchema// @ts-expect-error - customer is not always present.parse(event.customer),}),};});- console.log(response);-return NextResponse.json(response);},);