-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix FirstPromoter import #3000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FirstPromoter import #3000
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdded post-processing of Promise.allSettled results to log rejected affiliate imports with email context and made partnerGroupDefaultLinks access safe. Added an early-return guard when program.domain or program.url is missing, and added default-link provisioning for groups without default links during campaign import. Changes
Sequence Diagram(s)sequenceDiagram
participant Importer as Import-Partners
participant FP as FirstPromoter API
participant DB as Database/Logger
Note over Importer,FP: parallel affiliate imports (Promise.allSettled)
Importer->>FP: importAffiliate(a1)
Importer->>FP: importAffiliate(a2)
FP-->>Importer: settled(results)
Note right of Importer: collect results
alt rejected results exist
Importer->>DB: log error with affiliate email (isRejected)
end
Importer->>DB: continue with partner creation (use partnerGroupDefaultLinks[0]?.id ?? null)
sequenceDiagram
participant Importer as Import-Campaigns
participant FP as FirstPromoter API
participant DB as Database/LinkStore
Importer->>FP: fetchProgram(programId)
alt program.domain or program.url missing
Importer->>DB: log error and return (skip import)
else
loop per page/batch
Importer->>FP: fetchCampaigns(page)
FP-->>Importer: campaigns
Importer->>DB: create/update campaigns & groups
Note right of Importer: AFTER processing batch
Importer->>DB: query groups missing default links
alt groups need default links
Importer->>DB: create default links using program.domain/url
end
Importer->>Importer: increment page
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)apps/web/lib/firstpromoter/import-campaigns.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ners.
Summary by CodeRabbit