Skip to content

5 add endpoint to return suitable dates for all participants#13

Merged
TyostoKarry merged 3 commits into
mainfrom
5-add-endpoint-to-return-suitable-dates-for-all-participants
Oct 22, 2025
Merged

5 add endpoint to return suitable dates for all participants#13
TyostoKarry merged 3 commits into
mainfrom
5-add-endpoint-to-return-suitable-dates-for-all-participants

Conversation

@TyostoKarry

Copy link
Copy Markdown
Owner
  • Added GET /api/v1/event/{id}/results endpoint in EventController
    • Returns EventResultResponse showing dates all participants can attend
  • Introduced EventResultResponse DTO
    • Includes fromEvent() companion logic to compute suitable dates by intersecting participants votes
    • Returns an empty list when no votes or suitable dates are found
  • Updated EventService.addVote() to skip adding empty votes and prevent hidden entries that affected result accuracy
  • Added controller tests for getEventResults

NOTE: The result computation is implemented in the DTO’s companion object rather than the service layer, as it’s a simple derived transformation of existing event data, not a business operation requiring service logic.

- Implemented GET /api/v1/event/{id}/results to return dates suitable for all participants.
- Added EventResultResponse DTO with companion logic to compute suitable dates.

Chose to invoke getEventById() directly in the controller instead of adding a separate service method, as the result computation is a simple derived transformation rather than service-layer logic. When no votes exist or no suitable dates are found, an empty list is returned instead of raising an error.
- Skip creating a vote entry when no voted dates are provided
- Prevents hidden database entries that blocked the results endpoint from showing valid dates
- Add unit tests covering /api/v1/event/{id}/results endpoint
- Include cases for aggregated results, no votes, no suitable dates, and event not found
@TyostoKarry TyostoKarry self-assigned this Oct 22, 2025
@TyostoKarry TyostoKarry linked an issue Oct 22, 2025 that may be closed by this pull request
@TyostoKarry TyostoKarry merged commit be24ea8 into main Oct 22, 2025
1 check passed
@TyostoKarry TyostoKarry deleted the 5-add-endpoint-to-return-suitable-dates-for-all-participants branch October 22, 2025 07:34
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.

Add endpoint to return suitable dates for all participants

1 participant