4 implement participant voting for event dates - #12
Merged
TyostoKarry merged 6 commits intoOct 21, 2025
Conversation
- Added EventVote entity to represent participants’ votes on event date selections. - Extended Event entity with a one-to-many relationship to EventVote entries. - Configured cascading, eager fetching, and orphan removal for consistent persistence.
- Add DTOs for voting (VoteCreateRequest, VoteCreateResponse, VotesListItemDto)
- Extend EventService with addVote() to handle participant votes
- Update EventController with POST /api/v1/event/{id}/vote endpoint
- Ensure validation for allowed vote dates and replace previous participant votes
- Update EventDetailsResponse to match the format specified in the instructions - Combine EventDetailsResponse and VoteCreateResponse into single dto - Update dto use cases to match the new dtos
- Simplified layering by moving DTO mapping to the controller. - EventService.addVote() now returns the updated Event entity, and EventController handles conversion to EventDetailsResponse.
… argument errors Extended GlobalExceptionHandler beyond EventNotFoundException handling to include: - handleIllegalArgument maps IllegalArgumentException to HTTP 400 - handleJsonParseError maps HttpMessageNotReadableException to HTTP 400 - handleValidationError maps MethodArgumentNotValidException to HTTP 400 By explicitly returning ResponseEntity objects with error messages, these handlers ensure that both clients and tests receive the actual exception messages in the HTTP response body instead of default empty bodies produced by Spring's built-in error handling.
- Added vote-related controller test cases for success and error scenarios - Created comprehensive EventService tests covering all logic paths - Introduced nested groups in controller and service tests for clarity - Updated old controller error case tests to use .response.contentAsString instead of .resolvedException?.message after extending GlobalExceptionHandler
TyostoKarry
deleted the
4-implement-participant-voting-for-event-dates
branch
October 21, 2025 11:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EventVoteentity to represent participant votes on selected event dates.EventandEventVote.EventServicewithaddVote()method to handle new votes and updates.POST /api/v1/event/{id}/voteinEventController.GlobalExceptionHandlerto handle additional error types:IllegalArgumentExceptionmaps to HTTP 400HttpMessageNotReadableExceptionmaps to HTTP 400MethodArgumentNotValidExceptionmaps to HTTP 400ResponseEntity, ensuring clients receive informative responses.EventControllerTestto include event vote testsEventServiceTestto validate the business logic functionality