Skip to content

Feature/#2 투표 토글 및 투표 개수 조회 api 구현#61

Open
pykido wants to merge 10 commits intodevelopfrom
Feature/#2-투표_토글_및_투표_개수_조회_API_구현

Hidden character warning

The head ref may contain hidden characters: "Feature/#2-\ud22c\ud45c_\ud1a0\uae00_\ubc0f_\ud22c\ud45c_\uac1c\uc218_\uc870\ud68c_API_\uad6c\ud604"
Open

Feature/#2 투표 토글 및 투표 개수 조회 api 구현#61
pykido wants to merge 10 commits intodevelopfrom
Feature/#2-투표_토글_및_투표_개수_조회_API_구현

Conversation

@pykido
Copy link
Contributor

@pykido pykido commented Jan 26, 2026

🔥 연관된 이슈

close: #2

📜 작업 내용

  • 팀 투표 토글 및 투표 개수 조회 API를 구현하였습니다.
  • 댓글 CRUD API를 구현했을 때와 비슷하게 개발하였습니다.
  • 기존 MVP에서 구현한 '좋아요' 기능이 '팀 투표' 기능으로 바뀌었기에 해당 로직들을 조금 손 보아 마이그레이션하였습니다.

💬 리뷰 요구사항

  • 항상 좋은 리뷰 감사드립니다!

✨ 기타

  • 화이팅!!

@pykido pykido self-assigned this Jan 26, 2026
@pykido pykido added the ⭐️ 기능 구현 새로운 기능을 구현 label Jan 26, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 TeamVote domain model, repository, and schema table, plus a TeamVoteCommandService and secured TeamVoteController exposing 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.

JJimini

This comment was marked as resolved.

Copy link
Collaborator

@JJimini JJimini left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 전체적으로 final이 다 빠진 것 같아서 확인 부탁드립니다~
HTTP MethodAPI의 위치 등 같이 이야기 해보면 좋은 부분이 조금 있는 것 같아서 Request Changes로 남겨두겠습니다..!

Copy link
Contributor

@sjmoon00 sjmoon00 left a comment

Choose a reason for hiding this comment

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

잘 구현하신것 같습니다~
리뷰 확인 부탁드립니다!

Copy link
Collaborator

@JJimini JJimini left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 제가 내일은 확인이 어려울 것 같아 미리 approve 해두겠습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⭐️ 기능 구현 새로운 기능을 구현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 투표 토글 및 투표 개수 조회 API 구현

3 participants