The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update get-payout-or-throw.ts
Steven Tey788452402791
diff --git a/apps/web/lib/api/partners/get-payout-or-throw.ts b/apps/web/lib/api/partners/get-payout-or-throw.tsindex d74d19a291..a3d9325e2f 100644--- a/apps/web/lib/api/partners/get-payout-or-throw.ts+++ b/apps/web/lib/api/partners/get-payout-or-throw.ts@@ -12,15 +12,21 @@ export async function getPayoutOrThrow({const payout = await prisma.payout.findUnique({where: {id: payoutId,- programId,},});- if (!payout)+ if (!payout) {throw new DubApiError({code: "not_found",message: "Payout not found.",});+ }+ if (payout.programId !== programId) {+ throw new DubApiError({+ code: "not_found",+ message: "Payout does not belong to the program.",+ });+ }return PayoutSchema.parse(payout);}