-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add tenantId filter to GET /commissions
#2905
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 an optional Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant R as Commissions Route
participant Z as Zod Schema
participant E as ProgramEnrollment (Prisma)
participant P as Prisma (Commissions)
participant DB as Database
C->>R: GET /api/commissions?...&tenantId=...&partnerId=...
R->>Z: parse(getCommissionsQuerySchema)
Z-->>R: { programId, tenantId?, partnerId?, ... }
alt partnerId provided
Note over R: Use provided partnerId (highest precedence)
R->>P: findMany(where: { partnerId, programId, ... })
else tenantId provided and no partnerId
Note over R: Resolve partnerId via programEnrollment
R->>E: findFirst(where: { tenantId, programId })
alt enrollment found
E-->>R: { partnerId }
R->>P: findMany(where: { partnerId, programId, ... })
else none found
E-->>R: null
R-->>C: 404 DubApiError.not_found
end
else neither provided
R->>P: findMany(where: { programId, ... })
end
P->>DB: Execute query
DB-->>P: Results
P-->>R: Commissions[]
R-->>C: 200 OK JSON
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary by CodeRabbit