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.

Merge branch 'main' into reward-change-support

Kiran K59ce382a0111
diff --cc apps/web/lib/partners/create-partner-commission.ts
index a7ffce4f73,78280597bc..122ff913c5
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@@ -177,11 -187,13 +187,16 @@@ export const createPartnerCommission =
currency,
earnings,
status,
+ description,
createdAt,
+ rewardType: reward.type,
+ rewardAmount: reward.amount,
+ rewardMaxDuration: reward.maxDuration,
},
+ include: {
+ partner: true,
+ customer: true,
+ },
});
waitUntil(
diff --cc packages/prisma/schema/commission.prisma
index bc99fdd2b3,d2686775cd..bda48232ba
--- a/packages/prisma/schema/commission.prisma
+++ b/packages/prisma/schema/commission.prisma
@@@ -16,30 -16,25 +16,30 @@@ enum CommissionType
}
model Commission {
- id String @id @default(cuid())
- programId String
- partnerId String
- linkId String?
- payoutId String?
- invoiceId String? // only for sales (idempotency key, each sale event is associated with a unique invoice)
- customerId String? // only for leads and sales
- eventId String? @unique // only for leads and sales
-
- type CommissionType
- amount Int // only for sales (amount of the sale event)
- quantity Int // only for clicks/leads (quantity of the event)
- earnings Int @default(0) // amount earned by the partner
- currency String @default("usd")
- status CommissionStatus @default(pending)
-
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
+ id String @id @default(cuid())
+ programId String
+ partnerId String
+ linkId String?
+ payoutId String?
+ invoiceId String? // only for sales (idempotency key, each sale event is associated with a unique invoice)
+ customerId String? // only for leads and sales
+ eventId String? @unique // only for leads and sales
+ description String?
+ type CommissionType
+ amount Int // only for sales (amount of the sale event)
+ quantity Int // only for clicks/leads (quantity of the event)
+ earnings Int @default(0) // amount earned by the partner
+ currency String @default("usd")
+ status CommissionStatus @default(pending)
+ userId String? // user who created the manual commission
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ // Reward
+ rewardType RewardStructure?
+ rewardAmount Int?
+ rewardMaxDuration Int?
+
program Program @relation(fields: [programId], references: [id])
partner Partner @relation(fields: [partnerId], references: [id])
payout Payout? @relation(fields: [payoutId], references: [id])