Skip to content

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

Open
Sowmiya07 wants to merge 3 commits 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 3 commits into
Women-Coding-Community:mainfrom
Sowmiya07:feat/mentor-profile-self-serve

Conversation

@Sowmiya07

@Sowmiya07 Sowmiya07 commented Aug 17, 2026

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
  1. Resources data loss — ✅ Addressed: ResourcesSection hidden from EditMentorForm (logic kept intact); GitHub issue raised to track this separately
  2. Mentor ownership not enforced — ✅ Addressed: Added authService.requireSelfOrRoles(mentorId, ADMIN, MENTORSHIP_ADMIN) to both GET and PUT
    /mentors/{mentorId}.
  3. LEADER gets 403 on mentor detail — ✅ Addressed: GET includes LEADER in the allowed roles; PUT remains restricted to ADMIN/MENTORSHIP_ADMIN
    only.
  4. Links lack social-media type — TBC
  5. Long-term values are hardcoded — ✅ Addressed: Added longTermNumMentee and longTermHours inputs (min 1 mentee, min 2 hours) shown conditionally when LONG_TERM is
    selected.
  6. "Other" in languages/areas is misleading — Kept as-is — "Other" retained to cover areas not yet in the list, to be enriched in a future iteration.
  7. Years of experience allows 0 — experience is not mandatory to be mentors.
  8. String fields not trimmed — ✅ Addressed: .trim() applied to all string fields in both CreateMentorForm and EditMentorForm
  9. "Change Picture" button is dead — Button kept but left disabled until profile picture upload is implemented.
image image

@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.

2 participants