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 timestamps, fix createPartnerCommission

Steven Tey3fdff7a7398d
diff --git a/apps/web/lib/actions/partners/create-manual-commission.ts b/apps/web/lib/actions/partners/create-manual-commission.ts
index e082fcad1c..d3afe4dafc 100644
--- a/apps/web/lib/actions/partners/create-manual-commission.ts
+++ b/apps/web/lib/actions/partners/create-manual-commission.ts
@@ -197,7 +197,6 @@ export const createManualCommissionAction = authActionClient
...existingLeadEvent,
...newClickAttributes, // make sure new click attributes are not overridden by existing click attributes
event_id: nanoid(16), // create new event_id
- timestamp: new Date(existingLeadEvent.timestamp).toISOString(), // set to existing lead event's timestamp
link_id: link.id, // set to new link.id
customer_id: duplicateCustomerId, // set to new duplicateCustomerId
});
@@ -242,7 +241,6 @@ export const createManualCommissionAction = authActionClient
...existingSaleEvent,
...newClickAttributes, // make sure new click attributes are not overridden
event_id: nanoid(16), // create new event_id
- timestamp: new Date(existingSaleEvent.timestamp).toISOString(), // set to existing sale event's timestamp
link_id: link.id, // set to new link.id
customer_id: duplicateCustomerId, // set to new duplicateCustomerId
amount: existingSaleEvent.saleAmount, // change format returned by Tinybird
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.ts
index 5b081ff0fa..2212f1275c 100644
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@ -208,8 +208,8 @@ export const createPartnerCommission = async ({
rewardId: reward?.id,
customerId,
linkId,
- eventId,
- invoiceId,
+ eventId: eventId || null, // empty string should convert to null
+ invoiceId: invoiceId || null, // empty string should convert to null
userId: user?.id,
quantity,
amount,