Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix commission creation workflow (#3979)

Steven Tey692a0322473d
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/use-commission-filters.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/use-commission-filters.tsx
index 6fe0c28f98..6659d6d97b 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/use-commission-filters.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/commissions/use-commission-filters.tsx
@@ -79,7 +79,7 @@ export function useCommissionFilters() {
customers?.map((customer) => {
return {
value: customer.id,
- label: customer.email ?? customer.name,
+ label: customer.email ?? customer.name ?? customer.id,
icon: <CustomerAvatar customer={customer} className="size-4" />,
};
}) ?? null,
diff --git a/apps/web/lib/zod/schemas/customers.ts b/apps/web/lib/zod/schemas/customers.ts
index 3c859eb231..9cd0111e1a 100644
--- a/apps/web/lib/zod/schemas/customers.ts
+++ b/apps/web/lib/zod/schemas/customers.ts
@@ -139,7 +139,7 @@ export const CustomerSchema = z.object({
.describe(
"The unique ID of the customer. You may use either the customer's `id` on Dub (obtained via `/customers` endpoint) or their `externalId` (unique ID within your system, prefixed with `ext_`, e.g. `ext_123`).",
),
- name: z.string().describe("Name of the customer."),
+ name: z.string().nullish().describe("Name of the customer."),
email: z.string().nullish().describe("Email of the customer."),
avatar: z.string().nullish().describe("Avatar URL of the customer."),
externalId: z
diff --git a/packages/prisma/schema/discount.prisma b/packages/prisma/schema/discount.prisma
index 7704fc60c6..446b59de7d 100644
--- a/packages/prisma/schema/discount.prisma
+++ b/packages/prisma/schema/discount.prisma
@@ -39,7 +39,7 @@ model DiscountCode {
discount Discount? @relation(fields: [discountId], references: [id], onDelete: SetNull)
partner Partner @relation(fields: [partnerId], references: [id])
link Link @relation(fields: [linkId], references: [id])
- programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId])
+ programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId], onDelete: Cascade)
@@unique([programId, code])
@@index([programId, partnerId])