Skip to content

Fe be/teacher moderation - #141

Merged
Dmytro-Doronin merged 4 commits into
developfrom
FE-BE/teacher-moderation
Mar 3, 2026
Merged

Dmytro-Doronin merged 4 commits into
developfrom
FE-BE/teacher-moderation

Conversation

@Dmytro-Doronin

Copy link
Copy Markdown
Collaborator

Backend part:

  1. Added getTeacherByIdFor moderator and getAllTeachersForModerator
  2. Added protection from access to private moderators endpoints
  3. Hide very teachers account without status - "active"

Frontend part:

  1. Added router for moderator
  2. Added possibility to moderate teachers profile and put statuses:
image

Copilot AI review requested due to automatic review settings March 3, 2026 16:47
@HackYourFutures
HackYourFutures temporarily deployed to study-bridge-fe-be-teac-gln6uc March 3, 2026 16:47 Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a moderator-facing teachers moderation flow: backend adds moderator-specific teachers endpoints and restricts public teacher visibility to “active”, while the frontend adds moderator routing/UI to review teacher profiles and change statuses.

Changes:

  • Backend: add moderator endpoints to list/get teachers; restrict public teacher listing/detail to status === "active".
  • Frontend: add /moderator private routes + sidebar menu; add UI controls to change teacher status.
  • Frontend: add moderator APIs/hooks and optimistic update utilities for status changes.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
server/src/types/teacher/teacher.types.ts Adds moderator query input type for teacher listing.
server/src/routes/teacherRoute.ts Adds moderator-only teachers routes.
server/src/repositories/queryRepositories/teacher.query.ts Splits “active-only” public listing and adds moderator listing method.
server/src/controllers/teacher.controller.ts Uses active-only listing for public; adds moderator list/detail handlers; hides non-active teacher detail publicly.
client/src/util/statusButtons.tsx Adds UI mapping + class builder for status buttons.
client/src/util/patchTeachersList.util.ts Adds helpers to patch teacher status in cached lists.
client/src/store/authSession.store.ts Extends account type to include moderator.
client/src/router/routesVariables/pathVariables.ts Adds moderator base path + moderator private route variables.
client/src/router/routesVariables/moderatorPrivateRoutes.tsx Defines moderator private routes (teachers + teacher detail + chat).
client/src/router/router.tsx Adds /moderator protected route section.
client/src/router/RoleIndexRedirect.tsx Redirects users to role-specific home, including moderator.
client/src/pages/teacherDetail/teacherDetail.tsx Enables status moderation controls when on moderator routes.
client/src/pages/moderatorTeachersPage/ModeratorTeaschersPage.tsx Adds moderator teachers list page with pagination and status changes.
client/src/layouts/PrivateLayout.tsx Adds moderator sidebar items selection logic.
client/src/features/teachers/query/useTeachersQuery.tsx Adjusts teachers list query behavior.
client/src/features/teachers/query/useTeacherQuery.ts Chooses teacher detail API based on role (moderator vs public).
client/src/features/teachers/query/useTeacherForModeratorQuery.tsx Adds moderator teachers list query hook.
client/src/features/queryKeys.ts Extends teachers list key typing to include moderator params.
client/src/features/moderator/mutation/useChangeStatus.ts Adds mutation + optimistic cache update for teacher status changes.
client/src/components/teacherCard/teacherCard.tsx Adds status-aware styling and moderation controls + “Details” navigation for moderators.
client/src/components/statusChanger/StatusChange.tsx Adds status change button group component.
client/src/components/sidebar/sidebarMenuItems.ts Adds moderator sidebar menu items.
client/src/components/cardsList/CardsList.tsx Passes moderation props through to TeacherCard.
client/src/api/teacher/teacher.type.ts Adds TeacherStatus and moderator sort/query types.
client/src/api/teacher/teacher.api.ts Adds moderator teacher list and moderator teacher detail APIs.
client/src/api/moderator/moderator.type.ts Adds moderator user type.
client/src/api/moderator/moderator.api.ts Adds moderator “change teacher status” API.
client/src/api/auth/types.ts Extends UserType to include moderator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/src/features/teachers/query/useTeacherQuery.ts Outdated
Comment thread client/src/features/moderator/mutation/useChangeStatus.ts Outdated
Comment thread client/src/util/statusButtons.tsx
Comment thread client/src/layouts/PrivateLayout.tsx
Comment thread client/src/router/RoleIndexRedirect.tsx
Comment thread client/src/router/routesVariables/moderatorPrivateRoutes.tsx Outdated
Comment thread client/src/pages/teacherDetail/teacherDetail.tsx
Comment thread server/src/controllers/teacher.controller.ts
Comment thread server/src/types/teacher/teacher.types.ts
Comment thread client/src/features/queryKeys.ts Outdated
@HackYourFutures
HackYourFutures temporarily deployed to study-bridge-fe-be-teac-gln6uc March 3, 2026 17:28 Inactive
@Dmytro-Doronin
Dmytro-Doronin merged commit 9f397ec into develop Mar 3, 2026
2 checks passed

This branch was previously deployed

1 inactive deployment
study-bridge-fe-be-teac-gln6uc — d3845b14 Deployed Mar 3, 2026 by HackYourFutures
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