Referral Tracking API added#237
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
There was a problem hiding this comment.
Code Review
This pull request introduces several new referral-related API endpoints to the apiConfig.ts file, covering listing, resolving, importing, and updating referrals, as well as service-specific upload and status routes. Feedback focuses on enhancing security by implementing granular PRIVILEGE_CHECK constraints for each new route and ensuring consistency with existing modules. Additionally, the reviewer suggests including these routes in the academic year validation list where applicable and correcting minor comment formatting for better alignment with the codebase style.
| }, | ||
| }), | ||
|
|
||
| //referral API |
| '/user/v1/referrals': createRouteObject({ | ||
| post: { | ||
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | ||
| }, | ||
| }), |
There was a problem hiding this comment.
The new referral routes are missing PRIVILEGE_CHECK. To maintain consistency with other modules in this repository (such as LMS, Opportunity, and Cohorts) and to enable granular access control, it is recommended to include privilege checks. Since these routes relate to referral tracking, you can leverage the existing privilegeGroup.tracking definitions.
Additionally, if these referral operations are tied to a specific academic year, these routes should be added to the apiListForAcademicYear array at the end of this file to ensure the academicyearid header is validated by the middleware.
'/user/v1/referrals': createRouteObject({
post: {
ROLE_CHECK: rolesGroup.superadmin_regional_admin,
PRIVILEGE_CHECK: privilegeGroup.tracking.create,
},
}),| '/user/v1/referrals/list': createRouteObject({ | ||
| post: { | ||
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | ||
| }, | ||
| }), |
There was a problem hiding this comment.
| '/user/v1/referrals/resolve': createRouteObject({ | ||
| get: { | ||
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | ||
| }, | ||
| }), |
| '/user/v1/referrals/:id': createRouteObject({ | ||
| patch: { | ||
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | ||
| }, | ||
| }), |
There was a problem hiding this comment.
The patch endpoint for individual referrals should be protected with the corresponding update privilege.
| '/user/v1/referrals/:id': createRouteObject({ | |
| patch: { | |
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | |
| }, | |
| }), | |
| '/user/v1/referrals/:id': createRouteObject({ | |
| patch: { | |
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | |
| PRIVILEGE_CHECK: privilegeGroup.tracking.update, | |
| }, | |
| }), |
| '/aspirespecific/import-users/referrals/upload': createRouteObject({ | ||
| post: { | ||
| ROLE_CHECK: rolesGroup.superadmin_regional_admin, | ||
| }, | ||
| }), |
There was a problem hiding this comment.


No description provided.