The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update import-customers.ts
Kiran K5f4219e989d6
diff --git a/apps/web/lib/partnerstack/import-customers.ts b/apps/web/lib/partnerstack/import-customers.tsindex c07d0ab4f5..947b4c5932 100644--- a/apps/web/lib/partnerstack/import-customers.ts+++ b/apps/web/lib/partnerstack/import-customers.ts@@ -55,6 +55,7 @@ export async function importCustomers(payload: PartnerStackImportPayload) {break;}+ // Identify the Partner on Dub from PS partnership_keyconst partnerKeys = [...new Set(customers.map(({ partnership_key }) => partnership_key)),];@@ -158,10 +159,19 @@ async function createCustomer({return;}- const customerFound = await prisma.customer.findFirst({+ // Find the customer by email address+ let customerFound = await prisma.customer.findFirst({where: {- projectId: workspace.id,- email: customer.email,+ OR: [+ {+ projectId: workspace.id,+ email: customer.email,+ },+ {+ projectId: workspace.id,+ externalId: customer.customer_key,+ },+ ],},});