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.

Update create-and-enroll-partner.ts

Kiran K8e3b08cc66e3
diff --git a/apps/web/lib/api/partners/create-and-enroll-partner.ts b/apps/web/lib/api/partners/create-and-enroll-partner.ts
index effa783ea0..2157d2a3f2 100644
--- a/apps/web/lib/api/partners/create-and-enroll-partner.ts
+++ b/apps/web/lib/api/partners/create-and-enroll-partner.ts
@@ -11,6 +11,7 @@ import { nanoid } from "@dub/utils";
import { waitUntil } from "@vercel/functions";
import { DubApiError } from "../errors";
import { getGroupOrThrow } from "../groups/get-group-or-throw";
+import { backfillLinkCommissions } from "./backfill-link-commissions";
import { createDefaultPartnerLinks } from "./create-default-partner-links";
interface CreateAndEnrollPartnerInput {
@@ -163,6 +164,14 @@ export const createAndEnrollPartner = async ({
waitUntil(
Promise.all([
+ links.map((link) =>
+ backfillLinkCommissions({
+ id: link.id,
+ partnerId: upsertedPartner.id,
+ programId: program.id,
+ }),
+ ),
+
// upload partner image to R2
partner.image &&
!isStored(partner.image) &&