11package com .swyp .picke .domain .vote .controller ;
22
3+ import com .swyp .picke .domain .vote .dto .request .QuizVoteRequest ;
34import com .swyp .picke .domain .vote .dto .request .VoteRequest ;
4- import com .swyp .picke .domain .vote .dto .response .MyVoteResponse ;
5- import com .swyp .picke .domain .vote .dto .response .VoteResultResponse ;
6- import com .swyp .picke .domain .vote .dto .response .VoteStatsResponse ;
5+ import com .swyp .picke .domain .vote .dto .response .*;
6+ import com .swyp .picke .domain .vote .service .QuizVoteService ;
77import com .swyp .picke .domain .vote .service .VoteService ;
88import com .swyp .picke .global .common .response .ApiResponse ;
99import io .swagger .v3 .oas .annotations .Operation ;
1919@ RequiredArgsConstructor
2020public class VoteController {
2121
22+ // 배틀(BATTLE) 전용 서비스
2223 private final VoteService voteService ;
24+ // 퀴즈(QUIZ) & 투표(POLL) 전용 서비스
25+ private final QuizVoteService quizVoteService ;
2326
24- @ Operation (summary = "사전 투표 실행" , description = "배틀 진입 시 첫 투표(사전 투표)를 진행합니다." )
27+ @ Operation (summary = "[퀴즈] 선택 제출" )
28+ @ PostMapping ("/battles/{battleId}/quiz-vote" )
29+ public ApiResponse <QuizVoteResponse > submitQuiz (
30+ @ PathVariable Long battleId ,
31+ @ AuthenticationPrincipal Long userId ,
32+ @ RequestBody QuizVoteRequest request ) {
33+ return ApiResponse .onSuccess (quizVoteService .submitQuiz (battleId , userId , request ));
34+ }
35+
36+ @ Operation (summary = "[투표] 선택 제출" )
37+ @ PostMapping ("/battles/{battleId}/poll-vote" )
38+ public ApiResponse <PollVoteResponse > submitPoll (
39+ @ PathVariable Long battleId ,
40+ @ AuthenticationPrincipal Long userId ,
41+ @ RequestBody QuizVoteRequest request ) {
42+ return ApiResponse .onSuccess (quizVoteService .submitPoll (battleId , userId , request ));
43+ }
44+
45+ @ Operation (summary = "[퀴즈] 내 퀴즈 참여 내역 조회" , description = "내가 선택한 퀴즈 옵션과 통계를 조회합니다." )
46+ @ GetMapping ("/battles/{battleId}/quiz-vote/me" )
47+ public ApiResponse <QuizVoteResponse > getMyQuizVote (
48+ @ PathVariable Long battleId ,
49+ @ AuthenticationPrincipal Long userId ) {
50+ return ApiResponse .onSuccess (quizVoteService .getMyQuizVote (battleId , userId ));
51+ }
52+
53+ @ Operation (summary = "[투표] 내 투표 참여 내역 조회" , description = "내가 선택한 투표 옵션과 통계를 조회합니다." )
54+ @ GetMapping ("/battles/{battleId}/poll-vote/me" )
55+ public ApiResponse <PollVoteResponse > getMyPollVote (
56+ @ PathVariable Long battleId ,
57+ @ AuthenticationPrincipal Long userId ) {
58+ return ApiResponse .onSuccess (quizVoteService .getMyPollVote (battleId , userId ));
59+ }
60+
61+ // 2. 배틀(BATTLE) 관련 API
62+
63+ @ Operation (summary = "[배틀] 사전 투표 실행" , description = "배틀 진입 시 첫 투표(사전 투표)를 진행합니다." )
2564 @ PostMapping ("/battles/{battleId}/votes/pre" )
2665 public ApiResponse <VoteResultResponse > preVote (
2766 @ PathVariable Long battleId ,
@@ -30,7 +69,7 @@ public ApiResponse<VoteResultResponse> preVote(
3069 return ApiResponse .onSuccess (voteService .preVote (battleId , userId , request ));
3170 }
3271
33- @ Operation (summary = "사후 투표 실행" , description = "콘텐츠 소비 후 최종 투표(사후 투표)를 진행합니다." )
72+ @ Operation (summary = "[배틀] 사후 투표 실행" , description = "콘텐츠 소비 후 최종 투표(사후 투표)를 진행합니다." )
3473 @ PostMapping ("/battles/{battleId}/votes/post" )
3574 public ApiResponse <VoteResultResponse > postVote (
3675 @ PathVariable Long battleId ,
@@ -39,21 +78,21 @@ public ApiResponse<VoteResultResponse> postVote(
3978 return ApiResponse .onSuccess (voteService .postVote (battleId , userId , request ));
4079 }
4180
42- @ Operation (summary = "투표 통계 조회" , description = "특정 배틀의 옵션별 투표 수와 비율을 조회합니다." )
81+ @ Operation (summary = "[배틀] 투표 통계 조회" , description = "특정 배틀의 옵션별 투표 수와 비율을 조회합니다." )
4382 @ GetMapping ("/battles/{battleId}/vote-stats" )
4483 public ApiResponse <VoteStatsResponse > getVoteStats (@ PathVariable Long battleId ) {
4584 return ApiResponse .onSuccess (voteService .getVoteStats (battleId ));
4685 }
4786
48- @ Operation (summary = "내 투표 내역 조회" , description = "특정 배틀에 대한 내 사전/사후 투표 내역과 현재 상태를 조회합니다." )
87+ @ Operation (summary = "[배틀] 내 투표 내역 조회" , description = "특정 배틀에 대한 내 사전/사후 투표 내역과 현재 상태를 조회합니다." )
4988 @ GetMapping ("/battles/{battleId}/votes/me" )
5089 public ApiResponse <MyVoteResponse > getMyVote (
5190 @ PathVariable Long battleId ,
5291 @ AuthenticationPrincipal Long userId ) {
5392 return ApiResponse .onSuccess (voteService .getMyVote (battleId , userId ));
5493 }
5594
56- @ Operation (summary = "오디오(TTS) 청취 완료 처리" , description = "사전 투표 후, 오디오 재생이 완료되었을 때 호출하여 상태를 업데이트합니다." )
95+ @ Operation (summary = "[배틀] 오디오(TTS) 청취 완료 처리" , description = "사전 투표 후, 오디오 재생이 완료되었을 때 호출하여 상태를 업데이트합니다." )
5796 @ PostMapping ("/battles/{battleId}/votes/tts-complete" )
5897 public ApiResponse <Void > completeTts (
5998 @ PathVariable Long battleId ,
0 commit comments