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.

Add initiatedAt column to Payout table

Steven Tey07fca3880aee
diff --git a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
index 8f22c04af6..c915f460a2 100644
--- a/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
+++ b/apps/web/app/(ee)/api/cron/payouts/process/process-payouts.ts
@@ -283,6 +283,7 @@ export async function processPayouts({
invoiceId: invoice.id,
status: "processing",
userId,
+ initiatedAt: new Date(),
mode: "internal",
},
});
@@ -300,6 +301,7 @@ export async function processPayouts({
invoiceId: invoice.id,
status: "processing",
userId,
+ initiatedAt: new Date(),
mode: "external",
},
});
@@ -351,8 +353,9 @@ export async function processPayouts({
...payout,
invoiceId: invoice.id,
status: "processing",
- mode: externalPayoutsMap.has(payout.id) ? "external" : "internal",
userId,
+ initiatedAt: new Date(),
+ mode: externalPayoutsMap.has(payout.id) ? "external" : "internal",
},
},
],
diff --git a/packages/prisma/schema/payout.prisma b/packages/prisma/schema/payout.prisma
index f3bb679865..e77e167ee5 100644
--- a/packages/prisma/schema/payout.prisma
+++ b/packages/prisma/schema/payout.prisma
@@ -18,7 +18,6 @@ model Payout {
programId String
partnerId String
invoiceId String?
- userId String? // user who made the payout
amount Int @default(0)
currency String @default("USD")
status PayoutStatus @default(pending)
@@ -33,6 +32,9 @@ model Payout {
webhookEventId String? @unique // only for external payouts
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
+
+ userId String? // user who made the payout
+ initiatedAt DateTime?
paidAt DateTime?
program Program @relation(fields: [programId], references: [id])