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 the date

Kiran K42ac7b04c3d7
diff --git a/apps/web/lib/actions/partners/create-commission.ts b/apps/web/lib/actions/partners/create-commission.ts
index 47c2f26fc7..7c227293ac 100644
--- a/apps/web/lib/actions/partners/create-commission.ts
+++ b/apps/web/lib/actions/partners/create-commission.ts
@@ -103,7 +103,7 @@ export const createCommissionAction = authActionClient
workspaceId: workspace.id,
skipRatelimit: true,
timestamp: new Date(
- new Date(leadDate).getTime() - 5 * 60 * 1000,
+ new Date(leadDate!).getTime() - 5 * 60 * 1000,
).toISOString(),
});
@@ -121,7 +121,7 @@ export const createCommissionAction = authActionClient
event_id: leadEventId,
event_name: "Sign up",
customer_id: customerId,
- timestamp: new Date(leadDate).toISOString(),
+ timestamp: new Date(leadDate!).toISOString(),
});
// TODO:
diff --git a/apps/web/lib/zod/schemas/commissions.ts b/apps/web/lib/zod/schemas/commissions.ts
index 2b211603eb..b3e1f2d606 100644
--- a/apps/web/lib/zod/schemas/commissions.ts
+++ b/apps/web/lib/zod/schemas/commissions.ts
@@ -55,7 +55,7 @@ export const createCommissionSchema = z.object({
linkId: z.string(),
customerId: z.string(),
saleDate: parseDateSchema.nullish(),
- saleAmount: z.number().nullish(),
+ saleAmount: z.number().min(0).nullish(),
invoiceId: z.string().nullish(),
- leadDate: parseDateSchema,
+ leadDate: parseDateSchema.nullish(),
});