-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Ensure all programEnrollments uses pge_ ID prefix #2789
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
Conversation
WalkthroughAdds explicit ID generation for newly created ProgramEnrollment records across partner creation/import flows by injecting id: createId({ prefix: "pge_" }) into Prisma nested create/upsert payloads. No function signatures or control flow are changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
apps/web/lib/tolt/import-partners.ts (2)
159-164: Optional: centralize the pge_ ID construction.Reduce duplication/typos by exposing a helper and using it at call sites.
Apply:
- id: createId({ prefix: "pge_" }), + id: createProgramEnrollmentId(),Add in apps/web/lib/api/create-id.ts:
export const createProgramEnrollmentId = () => createId({ prefix: "pge_" });
159-164: Optional DB guardrail: enforce prefix at the schema layer.Add a CHECK to guarantee future writes (including ad-hoc scripts) keep the pge_ prefix.
Example (Postgres migration):
ALTER TABLE "ProgramEnrollment" ADD CONSTRAINT program_enrollment_id_prefix_chk CHECK (id LIKE 'pge_%');apps/web/lib/partnerstack/import-partners.ts (1)
180-189: If adopting helper, update here too.Switch to createProgramEnrollmentId() when available for consistency.
- id: createId({ prefix: "pge_" }), + id: createProgramEnrollmentId(),apps/web/lib/api/partners/create-and-enroll-partner.ts (1)
104-121: Optional: use shared helper for ID generation.Keeps call sites uniform and prevents prefix typos.
- id: createId({ prefix: "pge_" }), + id: createProgramEnrollmentId(),apps/web/lib/rewardful/import-partners.ts (1)
157-162: Optional: adopt shared helper once introduced.- id: createId({ prefix: "pge_" }), + id: createProgramEnrollmentId(),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
apps/web/lib/api/partners/create-and-enroll-partner.ts(1 hunks)apps/web/lib/partnerstack/import-partners.ts(1 hunks)apps/web/lib/rewardful/import-partners.ts(1 hunks)apps/web/lib/tolt/import-partners.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
apps/web/lib/tolt/import-partners.ts (1)
apps/web/lib/api/create-id.ts (1)
createId(60-69)
apps/web/lib/rewardful/import-partners.ts (1)
apps/web/lib/api/create-id.ts (1)
createId(60-69)
apps/web/lib/api/partners/create-and-enroll-partner.ts (1)
apps/web/lib/api/create-id.ts (1)
createId(60-69)
apps/web/lib/partnerstack/import-partners.ts (1)
apps/web/lib/api/create-id.ts (1)
createId(60-69)
⏰ 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). (2)
- GitHub Check: Vade Review
- GitHub Check: build
🔇 Additional comments (5)
apps/web/lib/tolt/import-partners.ts (2)
159-164: LGTM: ProgramEnrollment IDs now use pge_ prefix.Matches PR objective and maintains parity with other flows.
159-164: Verified: ‘pge_’ is allowlisted and all ProgramEnrollment create/upsert calls set the ID with createId({prefix: "pge_"}).apps/web/lib/partnerstack/import-partners.ts (1)
180-189: LGTM: consistent pge_ ID on create path.Aligned with other importers; update path untouched.
apps/web/lib/api/partners/create-and-enroll-partner.ts (1)
104-121: LGTM: nested ProgramEnrollment gets pge_ ID.Meets the PR goal; nested write is valid in Prisma.
apps/web/lib/rewardful/import-partners.ts (1)
157-162: LGTM: adds pge_ ID on upsert create.Consistent with other sources; no behavior change on update.
Summary by CodeRabbit