feat(admin): add Courses Without BR page (#142) - #184
Open
mohitmohan2005-wq wants to merge 1 commit into
Open
Conversation
Adds an admin page listing courses that have no branch representative assigned, backed by the getCoursesWithoutBR endpoint. - fetchCoursesWithoutBR in admin/src/apis/br.js - CoursesWithoutBR page + coursesWithoutBRTable component - Wire up /admin/courses-without-br route and sidebar nav item Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
DreamBot706
requested changes
Jul 30, 2026
DreamBot706
left a comment
Contributor
There was a problem hiding this comment.
Review Summary:
The implementation of the new page and routing works, but there are security and performance issues that need fixing before this can be merged. We also need to stick to the established naming conventions. Address the inline comments below.
File Comments:
-
File:
admin/src/apis/br.js- Comment: Security: You are using a hardcoded token (
Bearer admin-coursehub-cc23-golang) in the Authorization header. Fetch this dynamically from environment variables or secure storage (likelocalStorage), similar to how authentication is handled in other API functions. Never hardcode tokens.
- Comment: Security: You are using a hardcoded token (
-
File:
admin/src/components/coursesWithoutBRTable.jsx- Comment: Convention: Rename this file to PascalCase (
CoursesWithoutBRTable.jsx) to match the naming convention of all other React components in this project. - Comment: UX: If the
coursesarray is empty, the table renders headers but no rows. Implement a proper empty state (e.g., a "No courses found" message) whencourses.length === 0.
- Comment: Convention: Rename this file to PascalCase (
-
File:
server/modules/br/br.controller.js(Function:getCoursesWithoutBR)- Comment: Performance: This function fetches all users, all BR records, and all courses into application memory before filtering them in JavaScript. This will not scale. Refactor this to use MongoDB aggregation (
$lookupand$match) so the filtering is done at the database level.
- Comment: Performance: This function fetches all users, all BR records, and all courses into application memory before filtering them in JavaScript. This will not scale. Refactor this to use MongoDB aggregation (
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #142
Adds an admin page listing courses that have no branch representative assigned, backed by the getCoursesWithoutBR endpoint.