Skip to content

Add Admin UI & backend changes for Self Serving Mentor Profile Update - #770

Open
Sowmiya07 wants to merge 1 commit into
Women-Coding-Community:mainfrom
Sowmiya07:feat/mentor-profile-self-serve
Open

Add Admin UI & backend changes for Self Serving Mentor Profile Update#770
Sowmiya07 wants to merge 1 commit into
Women-Coding-Community:mainfrom
Sowmiya07:feat/mentor-profile-self-serve

Conversation

@Sowmiya07

Copy link
Copy Markdown
Contributor

PR Summary

Title: feat: Mentor self-profile edit page and GET mentor by ID endpoint

Summary

  • Adds a self-service profile edit page for mentors at /admin/mentor/profile
  • Secures GET /api/platform/v1/mentors/{mentorId} with MENTOR_PROFILE_UPDATE permission so mentors can fetch their own profile
  • Implements the missing getMentorById service method in MentorshipService
  • Optimises the frontend getMentorById service call to use the direct endpoint instead of fetching all mentors and filtering client-side

Backend Changes

MentorController

  • GET /mentors/{mentorId}: replaced @RequiresRole({ADMIN, LEADER, MENTORSHIP_ADMIN}) with @RequiresPermission(MENTOR_PROFILE_UPDATE), granting access to ADMIN, MENTORSHIP_ADMIN, and MENTOR roles

MentorshipService

  • Added getMentorById(Long mentorId): finds mentor by ID, throws MemberNotFoundException if absent, enriches with profile picture, returns MentorDto

Frontend Changes

admin-wcc-app/pages/admin/mentor/profile.tsx (new)

  • Protected page restricted to MENTOR role
  • Reads member.id from the auth context and passes it to EditMentorForm
  • Handles loading state and a graceful warning when no mentor record is linked to the account

admin-wcc-app/components/AdminLayout.tsx

  • Added "My Profile" nav link visible only to isMentor (not isAdmin || isMentor)

admin-wcc-app/services/mentorService.ts

  • getMentorById now calls GET /api/platform/v1/mentors/{id} directly instead of fetching the full mentor list and filtering client-side — necessary because MENTOR role users do not have access to the list endpoint
Picture1 Picture2 Picture3 Picture4

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant