The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Allow shared tremendous email across partners
Kiran Kc856252b1e29
diff --git a/apps/web/app/(ee)/api/embed/referrals/tremendous/send-otp/route.ts b/apps/web/app/(ee)/api/embed/referrals/tremendous/send-otp/route.tsindex 8f78462b2d..740c8f10f4 100644--- a/apps/web/app/(ee)/api/embed/referrals/tremendous/send-otp/route.ts+++ b/apps/web/app/(ee)/api/embed/referrals/tremendous/send-otp/route.ts@@ -75,30 +75,16 @@ export const POST = withReferralsEmbedToken(});}- const [partner, duplicatePartner] = await prisma.$transaction([- prisma.partner.findUniqueOrThrow({- where: {- id: partnerId,- },- select: {- id: true,- country: true,- defaultPayoutMethod: true,- },- }),-- prisma.partner.findFirst({- where: {- tremendousEmail: email,- id: {- not: partnerId,- },- },- select: {- id: true,- },- }),- ]);+ const partner = await prisma.partner.findUniqueOrThrow({+ where: {+ id: partnerId,+ },+ select: {+ id: true,+ country: true,+ defaultPayoutMethod: true,+ },+ });if (partner.country &&@@ -117,14 +103,6 @@ export const POST = withReferralsEmbedToken(});}- if (duplicatePartner) {- throw new DubApiError({- code: "conflict",- message:- "Unable to save partner details. Please verify the email address and try again.",- });- }-const code = generateOTP();const identifier = `tremendous:${partnerId}:${email}`;diff --git a/apps/web/app/(ee)/api/embed/referrals/tremendous/verify-otp/route.ts b/apps/web/app/(ee)/api/embed/referrals/tremendous/verify-otp/route.tsindex 84fbc180b1..d0f0058218 100644--- a/apps/web/app/(ee)/api/embed/referrals/tremendous/verify-otp/route.ts+++ b/apps/web/app/(ee)/api/embed/referrals/tremendous/verify-otp/route.ts@@ -73,30 +73,16 @@ export const POST = withReferralsEmbedToken(});}- const [partner, duplicatePartner] = await prisma.$transaction([- prisma.partner.findUniqueOrThrow({- where: {- id: partnerId,- },- select: {- id: true,- country: true,- defaultPayoutMethod: true,- },- }),-- prisma.partner.findFirst({- where: {- tremendousEmail: email,- id: {- not: partnerId,- },- },- select: {- id: true,- },- }),- ]);+ const partner = await prisma.partner.findUniqueOrThrow({+ where: {+ id: partnerId,+ },+ select: {+ id: true,+ country: true,+ defaultPayoutMethod: true,+ },+ });if (partner.country &&@@ -115,14 +101,6 @@ export const POST = withReferralsEmbedToken(});}- if (duplicatePartner) {- throw new DubApiError({- code: "conflict",- message:- "Unable to save partner details. Please verify the email address and try again.",- });- }-const identifier = `tremendous:${partnerId}:${email}`;const verificationToken = await prisma.emailVerificationToken.findUnique({diff --git a/apps/web/prisma/schema/partner.prisma b/apps/web/prisma/schema/partner.prismaindex 57542d208f..900a4f0ae4 100644--- a/apps/web/prisma/schema/partner.prisma+++ b/apps/web/prisma/schema/partner.prisma@@ -70,7 +70,7 @@ model Partner {stripeRecipientId String? @uniquepayoutMethodHash String?cryptoWalletAddress String?- tremendousEmail String? @unique+ tremendousEmail String?// timestamp fieldscreatedAt DateTime @default(now())@@ -119,6 +119,7 @@ model Partner {@@index(cryptoWalletAddress)@@index(identityVerifiedAt)@@index(referredByPartnerId)+ @@index(tremendousEmail)@@fulltext([email, name, companyName]) // For full-text search}