Skip to content

feat: dynamic member types and validation hardening for Member and Mentor #667

Merged
dricazenck merged 17 commits into
Women-Coding-Community:mainfrom
dricazenck:feat/member-type-handling-and-validation
Jun 15, 2026
Merged

feat: dynamic member types and validation hardening for Member and Mentor #667
dricazenck merged 17 commits into
Women-Coding-Community:mainfrom
dricazenck:feat/member-type-handling-and-validation

Conversation

@dricazenck

@dricazenck dricazenck commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR introduces two main improvements to the member and mentorship domain.

  1. Mentor.memberTypes is now dynamically configured via constructor parameter instead of being hardcoded to [MENTOR], making member type assignment consistent and flexible across the platform.
  2. Validation annotations with explicit messages are added to Member, MemberDto, Mentee, and Skills, so consumers receive clear error feedback on bad input.
  • Additional fixes included: CollaboratorPage now correctly uses MemberDto instead of Member (which lacked the necessary serialisation contract), EmailRequest builder defaults are restored and @Validated is added to the controller, and a set of failing integration tests are corrected to align.

Related Issue

Change Type

  • Bug Fix
  • Code Refactor

Screenshots

image

Pull request checklist

Please check if your PR fulfills the following requirements:

dricazenck added 8 commits May 7, 2026 06:59
The CollaboratorPage record was using the Member entity directly in its
collaborators list, coupling the API response layer to the domain model.
This caused a mismatch since collaborators should be presented as DTOs
rather than exposing the full entity with its validation constraints.
Bean validation constraints on Member, MemberDto, and LeadershipMember
previously used generic messages that were unhelpful to API consumers.
This change adds @validated, human-readable error messages, and moves
memberTypes assignment to MemberService so the field remains server-
controlled rather than populated from client input.
Mentor previously hardcoded [MENTOR] as its memberTypes in the
constructor, silently discarding any prior types when an existing
Member registered as a Mentor. MentorshipService now assigns
memberTypes explicitly and merges them with the existing member's
types, preserving the full type history across community roles.
Mentee and Skills validation constraints used @NotNull for list fields
where an empty list is equally invalid. This replaces them with
@notempty, adds @validated, and provides context-specific messages to
give API consumers clearer feedback when registration input is missing
required fields like spoken languages or mentorship focus areas.
Lombok's @builder strips field initializers by default, so EmailRequest
lost its default values for recipients (empty list) and html (true)
when constructed via the builder API. @Builder.Default restores the
intended defaults. PaginationUtil gains @validated to enable method-
level constraint checking on its parameters.
…into feat/member-type-handling-and-validation
…into feat/member-type-handling-and-validation
dricazenck added 3 commits May 9, 2026 18:01
… update related tests

Standardize API responses and improve consistency by switching MentorshipService methods to return MentorDto, updating tests and controller logic accordingly.
…lidation' into feat/member-type-handling-and-validation
Comment thread src/main/java/com/wcc/platform/controller/MentorController.java
…mber-type-handling-and-validation

# Conflicts:
#	src/main/java/com/wcc/platform/domain/platform/mentorship/Mentee.java
#	src/testInt/java/com/wcc/platform/repository/postgres/PostgresMemberRepositoryIntegrationTest.java
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
17.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

…into feat/member-type-handling-and-validation
Comment thread src/main/java/com/wcc/platform/service/MentorshipService.java Outdated

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

Looks fine, but i think we should not change the service layer to return the DTO object, rather do the mapping in the controller. @dricazenck - what do you think ?

…into feat/member-type-handling-and-validation
Comment thread src/main/java/com/wcc/platform/utils/PaginationUtil.java
…onversions, and clean up unused dependencies in tests
…and MemberDto, enhance builder pattern usage, and clean up tests
@sonarqubecloud

Copy link
Copy Markdown

@dricazenck dricazenck merged commit 6594285 into Women-Coding-Community:main Jun 15, 2026
5 of 6 checks passed
@dricazenck dricazenck deleted the feat/member-type-handling-and-validation branch June 15, 2026 21:32
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