Feature/#2 투표 토글 및 투표 개수 조회 api 구현#61
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a full “team vote” feature: toggling votes per team within a contest and querying a member’s remaining vote capacity, along with persistence, service, controller, tests, and API documentation.
Changes:
- Added
TeamVotedomain model, repository, and schema table, plus aTeamVoteCommandServiceand securedTeamVoteControllerexposing vote-toggle and member-vote-count endpoints. - Implemented exception types (
TeamVoteExceptionType,TeamVoteException) and contest voting-period validation, and wired them into new and existing convenience layers. - Added comprehensive integration tests, RestDocs-based API tests, and Asciidoc documentation for the new team vote APIs, including updates to shared fixtures and the API index.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/opus/opus/team/application/TeamVoteCommandServiceTest.java | Integration tests covering vote toggling behavior, limits, and member vote-count semantics. |
| src/test/java/com/opus/opus/team/TeamVoteFixture.java | Test fixture for creating TeamVote entities with configurable team, memberId, and isVoted flag. |
| src/test/java/com/opus/opus/team/TeamFixture.java | Extended team fixture to support creating teams for a given contest, used by vote tests. |
| src/test/java/com/opus/opus/restdocs/docs/TeamVoteApiDocsTest.java | RestDocs tests documenting success and error scenarios for vote toggle and member vote-count endpoints (one set of description constants currently unused). |
| src/test/java/com/opus/opus/restdocs/RestDocsTest.java | Included TeamVoteController in the WebMvc slice and added a mock TeamVoteCommandService for RestDocs. |
| src/main/resources/schema.sql | Added team_vote DDL and ensured it’s dropped/created alongside other team-related tables. |
| src/main/java/com/opus/opus/modules/team/exception/TeamVoteExceptionType.java | Defined vote-specific error types (already voted/unvoted, vote limit exceeded) with HTTP mappings and messages. |
| src/main/java/com/opus/opus/modules/team/exception/TeamVoteException.java | Exception wrapper for TeamVoteExceptionType, consistent with other module exceptions. |
| src/main/java/com/opus/opus/modules/team/domain/dao/TeamVoteRepository.java | Repository for TeamVote with methods to find a member’s vote for a team and count active votes per contest. |
| src/main/java/com/opus/opus/modules/team/domain/dao/TeamCommentRepository.java | Removed unused deleteAllByTeamId to simplify the comment repository interface. |
| src/main/java/com/opus/opus/modules/team/domain/TeamVote.java | New JPA entity representing a member’s vote on a team, linked to Team and tracking isVoted. |
| src/main/java/com/opus/opus/modules/team/domain/Team.java | Added a teamVotes collection to model the one-to-many relation from team to votes. |
| src/main/java/com/opus/opus/modules/team/application/dto/response/TeamVoteToggleResponse.java | Response DTO for toggle operations, including derived remaining-vote count and max limit. |
| src/main/java/com/opus/opus/modules/team/application/dto/response/MemberVoteCountResponse.java | DTO returning a member’s remaining vote slots and the contest’s max vote limit. |
| src/main/java/com/opus/opus/modules/team/application/dto/request/TeamVoteToggleRequest.java | Request DTO for toggling a vote with a mandatory isVoted flag. |
| src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java | Core service implementing vote toggle logic, enforcing voting period and max-vote limits, and exposing member vote-count computation. |
| src/main/java/com/opus/opus/modules/team/api/TeamVoteController.java | Secured REST controller exposing PATCH /teams/{teamId}/votes and GET /teams/votes endpoints for vote toggling and member vote-count retrieval. |
| src/main/java/com/opus/opus/modules/contest/exception/ContestExceptionType.java | Added NOT_VOTE_PERIOD_NOW contest error to represent calls outside the permitted voting window. |
| src/main/java/com/opus/opus/modules/contest/application/convenience/ContestConvenience.java | Added validateVotingPeriod helper that throws when a contest is not in its voting period. |
| src/main/java/com/opus/opus/docs/asciidoc/team-vote.adoc | New Asciidoc page documenting team vote toggle and member vote-count APIs, including success and error cases (with a small mismatch in wording vs actual response semantics). |
| src/main/java/com/opus/opus/docs/asciidoc/opus.adoc | Linked the new team vote documentation page into the main API index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/com/opus/opus/restdocs/docs/TeamVoteApiDocsTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Outdated
Show resolved
Hide resolved
JJimini
requested changes
Jan 30, 2026
src/main/java/com/opus/opus/modules/contest/application/convenience/ContestConvenience.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/api/TeamVoteController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/api/TeamVoteController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/api/TeamVoteController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Outdated
Show resolved
Hide resolved
src/test/java/com/opus/opus/team/application/TeamVoteCommandServiceTest.java
Show resolved
Hide resolved
sjmoon00
reviewed
Jan 30, 2026
Contributor
sjmoon00
left a comment
There was a problem hiding this comment.
잘 구현하신것 같습니다~
리뷰 확인 부탁드립니다!
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Show resolved
Hide resolved
src/main/java/com/opus/opus/modules/team/application/TeamVoteCommandService.java
Outdated
Show resolved
Hide resolved
# Conflicts: # src/main/java/com/opus/opus/modules/team/api/TeamController.java # src/test/java/com/opus/opus/restdocs/RestDocsTest.java
JJimini
approved these changes
Feb 9, 2026
Collaborator
JJimini
left a comment
There was a problem hiding this comment.
고생하셨습니다! 제가 내일은 확인이 어려울 것 같아 미리 approve 해두겠습니다!
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.
🔥 연관된 이슈
close: #2
📜 작업 내용
💬 리뷰 요구사항
✨ 기타