The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix customer-created
Steven Teyb1289168096c
diff --git a/apps/web/app/api/stripe/integration/webhook/customer-created.ts b/apps/web/app/api/stripe/integration/webhook/customer-created.tsindex b1daa4928e..1be941f234 100644--- a/apps/web/app/api/stripe/integration/webhook/customer-created.ts+++ b/apps/web/app/api/stripe/integration/webhook/customer-created.ts@@ -35,8 +35,8 @@ export async function customerCreated(event: Stripe.Event) {},});- if (!link) {- return `Link with ID ${linkId} not found, skipping...`;+ if (!link || !link.projectId) {+ return `Link with ID ${linkId} not found or does not have a project, skipping...`;}// Check the customer is not already created@@ -61,15 +61,11 @@ export async function customerCreated(event: Stripe.Event) {stripeCustomerId: stripeCustomer.id,projectConnectId: stripeAccountId,externalId,+ projectId: link.projectId,linkId,clickId,clickedAt: new Date(clickData.timestamp + "Z"),country: clickData.country,- project: {- connect: {- stripeConnectId: stripeAccountId,- },- },},});diff --git a/packages/prisma/schema/customer.prisma b/packages/prisma/schema/customer.prismaindex dc8d0fbdc8..6890467f8e 100644--- a/packages/prisma/schema/customer.prisma+++ b/packages/prisma/schema/customer.prisma@@ -4,17 +4,20 @@ model Customer {email String?avatar String? @db.LongTextexternalId String?+ stripeCustomerId String? @unique+linkId String?clickId String?clickedAt DateTime?country String?- project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+projectId StringprojectConnectId String?- stripeCustomerId String? @uniquecreatedAt DateTime @default(now())updatedAt DateTime @updatedAt++ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)link Link? @relation(fields: [linkId], references: [id])sales Sale[]