Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a moderator flow to the platform, covering both backend and frontend. On the backend, it introduces a moderator login endpoint, a moderator query repository, the ability for moderators to change a teacher's status (draft/pending/active/rejected/blocked), and role-based access control updates to existing endpoints. On the frontend, it adds a dedicated moderator login page that reuses the existing LoginForm component.
Changes:
- New moderator authentication and teacher-status-management APIs, including DB schema, types, repository, service, and controller
- Role-type refactoring (
Rolebroadened to include"moderator", a narrowerUsersRoleintroduced for student/teacher contexts) - New moderator login page on the frontend, reusing existing login UI with moderator-specific conditional rendering
Reviewed changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/controllers/moderator.controller.ts | New controller handling moderator login and teacher status change |
| server/src/routes/moderatorRoute.ts | New Express router for moderator endpoints |
| server/src/services/auth/auth.service.ts | Adds checkAuthModeratorCredentials, extends createRefreshSession role support |
| server/src/services/teacher/teacher.service.ts | Adds changeTeacherStatus method |
| server/src/repositories/queryRepositories/moderator.query.ts | New query repository for moderator lookups |
| server/src/repositories/commandRepositories/teacher.command.ts | Adds updateTeacherStatus command |
| server/src/db/schemes/moderator.schema.ts | New Mongoose schema/model for moderators |
| server/src/db/schemes/teacherSchema.ts | Adds status field to teacher schema |
| server/src/db/schemes/types/moderator.types.ts | New DB type definition for moderator |
| server/src/db/schemes/types/teacher.types.ts | Adds TeacherStatus type and status field |
| server/src/db/schemes/types/session.types.ts | Adds "moderator" to the session role enum |
| server/src/types/common.types.ts | Broadens Role, introduces UsersRole, adds RequestWithParamsAndBody |
| server/src/types/auth/auth.types.ts | Imports and uses the new shared Role/UsersRole types |
| server/src/middlewares/requireRole.middleware.ts | Fixes import source for Role type |
| server/src/controllers/auth.controller.ts | Extends getMe and updatePasswordController to handle moderator role |
| server/src/routes/authRoute.ts | Adds requireRole guard to update-password route |
| server/src/routes/appointmentRoute.ts | Adds requireRole("student") guard to appointment creation |
| server/src/utils/mappers/moderator.mapper.ts | New mapper from DB type to view type |
| server/src/utils/mappers/teacher.mapper.ts | Exposes status in teacher view type |
| server/src/composition/compositionRoot.ts | Registers new moderator DI bindings |
| server/src/composition/composition.types.ts | Adds DI symbols for moderator controller and query |
| server/src/app.ts | Mounts moderator router |
| server/index.d.ts | Updates global Express Role to include "moderator" |
| client/src/api/auth/types.ts | Extends Role to include "moderator" |
| client/src/api/moderator/moderator.api.ts | New API function for moderator login |
| client/src/features/moderator/mutation/useModeratorLogin.ts | New React Query mutation hook for moderator login |
| client/src/pages/loginModeratorPage/loginModeratorPage.tsx | New moderator login page component |
| client/src/components/auth/loginForm/LoginForm.tsx | Conditionally hides sign-up/recovery/Google auth for moderator role |
| client/src/router/routesVariables/pathVariables.ts | Adds moderator login path variable |
| client/src/router/routesVariables/authRoutes.tsx | Registers moderator login route |
| server/src/scripts/seedTeachers.ts | Adds status: "draft" to seeded teacher documents |
| server/src/types/teacher/teacher.types.ts | Adds status to TeacherViewType |
| server/src/types/student/student.types.ts | Updates role field to use UsersRole |
| server/src/types/moderator/moderator.ts | New view type definition for moderator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dashaaaa21
approved these changes
Mar 3, 2026
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.
Backend part:
Frontend part: added moderator login page
