Skip to content

Be fe/moderation flow#139

Merged
Dmytro-Doronin merged 4 commits intodevelopfrom
BE-FE/moderation-flow
Mar 3, 2026
Merged

Be fe/moderation flow#139
Dmytro-Doronin merged 4 commits intodevelopfrom
BE-FE/moderation-flow

Conversation

@Dmytro-Doronin
Copy link
Contributor

Backend part:

  1. Added modarator flow and possibility for moderator to change teacher status.
  2. Added moderator login flow (moderatorController, moderatorQueryRepository)

Frontend part: added moderator login page
image

Copilot AI review requested due to automatic review settings March 3, 2026 08:43
@HackYourFutures HackYourFutures temporarily deployed to study-bridge-be-fe-mode-waqqgq March 3, 2026 08:43 Inactive
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (Role broadened to include "moderator", a narrower UsersRole introduced 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.

@HackYourFutures HackYourFutures temporarily deployed to study-bridge-be-fe-mode-wjtcuu March 3, 2026 09:11 Inactive
@Dmytro-Doronin Dmytro-Doronin merged commit c57be93 into develop Mar 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants