Skip to content

feat: add optional year filter to admin cycles list (#800) - #803

Merged
dricazenck merged 2 commits into
Women-Coding-Community:mainfrom
wilsonadenuga:feat/800-cycles-year-filter
Oct 7, 2026
Merged

dricazenck merged 2 commits into
Women-Coding-Community:mainfrom
wilsonadenuga:feat/800-cycles-year-filter

Conversation

@wilsonadenuga

@wilsonadenuga wilsonadenuga commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds an optional year filter to the admin cycles list, so the response stays small as cycles
build up over the years.

GET /api/platform/v1/admin/mentorship/cycles/all?year=2026 returns only 2026 cycles. Without
year, it returns every cycle as before.

The controller now calls a new MentorshipCycleService.getCycles(year), which uses the existing
MentorshipCycleRepository.findByYear(Integer) when a year is given and getAll() otherwise.

year= Response
(none) 200, all cycles
2026 200, 2026 cycles
1990 (no data) 200, []
26, 0, 20260 400, "Year must be in YYYY format"
abc, 20a6 400, Spring's conversion message via the existing IllegalArgumentException handler
2026&year=2027 200, uses the first value

Notes:

  • The integration tests check findByYear at repository level, like the rest of
    MentorshipCycleIntegrationTest. The HTTP cases (no year, year=2026, bad values) are covered
    in the new MentorshipAdminMatchesControllerTest, since no integration test calls a
    token-protected admin endpoint yet.
  • No test for a duplicated year param. Spring binds the first value.

Related Issue

Closes #800

Change Type

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

Screenshots

Swagger screenshot of the year param on GET /cycles/all to follow.

Pull request checklist

Please check if your PR fulfills the following requirements:

Comment thread src/main/java/com/wcc/platform/controller/MentorshipAdminMatchesController.java Outdated
Comment thread src/main/java/com/wcc/platform/service/MentorshipCycleService.java Outdated
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@dricazenck
dricazenck merged commit d959957 into Women-Coding-Community:main Oct 7, 2026
6 checks passed
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.

feat: Add optional year filter to GET /api/platform/v1/admin/mentorship/cycles/all

2 participants