Skip to content

feat: add mentorship cycle creation endpoint - #804

Open
MichaelaMatiskova wants to merge 4 commits into
Women-Coding-Community:mainfrom
MichaelaMatiskova:feature/801-add-new-mentorship-cycle
Open

MichaelaMatiskova wants to merge 4 commits into
Women-Coding-Community:mainfrom
MichaelaMatiskova:feature/801-add-new-mentorship-cycle

Conversation

@MichaelaMatiskova

@MichaelaMatiskova MichaelaMatiskova commented Oct 4, 2026 •

Copy link
Copy Markdown

Allow authorized admins to create mentorship cycles in draft status with date validation, default mentee capacity, and duplicate-cycle conflict handling. Add request validation and unit/integration coverage for successful creation, invalid values, authorization, and conflicts.

Description

This pull request adds support for creating mentorship cycles through the admin API.
Authorized administrators can create new mentorship cycles in DRAFT status. The implementation includes:
• A new POST /api/platform/v1/admin/mentorship/cycles endpoint.
• Authorization for ADMIN and MENTORSHIP_ADMIN roles.
• A dedicated request DTO with Bean Validation constraints.
• Validation for registration and cycle date ordering.
• A default value of five mentees per mentor when no capacity is provided.
• Duplicate-cycle detection based on year, mentorship type, and month.
• Proper 409 CONFLICT responses for duplicate cycles.

Test Coverage

The change includes:
• Unit tests for cycle creation and draft status.
• Unit tests for default mentee capacity.
• Unit tests for date validation and duplicate exceptions.
• Controller tests for service delegation and role authorization.
• Integration tests for successful creation through the REST endpoint.
• Integration tests for duplicate-cycle conflicts.
• Integration tests for missing and invalid request values.
• Integration tests for invalid date ordering.

Note

The new cycles are always created in DRAFT status. They must be transitioned separately before becoming available for registration.

Swagger Verification

The endpoint was tested in Swagger UI with the following cases:

Success Case

Successfully created a mentorship cycle using valid request data. The response confirms that the cycle was created in DRAFT status.

Screenshot:

Snímka obrazovky 2026-10-11 155639

Failure Case

Attempted to create a mentorship cycle with invalid request data. The API returned an error response as expected.

Screenshots:

cecc4e38-79a7-4520-a607-be979ee29ba8 Snímka obrazovky 2026-10-11 155848

Change Type

  • Bug Fix
  • New Feature
  • Code Refactor
  • Documentation
  • Test
  • Other

Pull request checklist

Please check if your PR fulfills the following requirements:

@dricazenck dricazenck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribuition @MichaelaMatiskova nice changes, I left a few comments, once you address them and the open question from @Sowmiya07 is clarified we can merge the pr.

Would be nice if you can add the screenshot in the PR description to the success/failure cases so we can see working on swagger ;)

@Sowmiya07

Copy link
Copy Markdown
Contributor

@MichaelaMatiskova Thanks for picking up this issue. It's one of the critical pieces needed, and happy to see your contribution. Can you please address the review comments & resolve the conflicts please?

MichaelaMatiskova and others added 3 commits October 11, 2026 16:27
Allow authorized admins to create mentorship cycles in draft status
with date validation, default mentee capacity, and duplicate-cycle
conflict handling. Add request validation and unit/integration coverage
for successful creation, invalid values, authorization, and conflicts.
Create the mentorship cycle request before the assertion so the
exception-testing lambda contains only the service invocation.
Add Year and Month types with future-date validation for mentorship
cycle creation, restrict new cycles to February through November, and
return a readable error for invalid month values. Add matching entity
validation, a Flyway database constraint, and update affected tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the standard JaCoCo unit report location expected by CI and make
coverage verification depend on both unit and integration reports. Split
the mentorship cycle unit and integration tests into focused classes so
they comply with the PMD TooManyMethods rule while preserving existing
coverage and test behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

3 participants