|
1 | 1 | package devkor.com.teamcback.domain.vote.controller; |
2 | 2 |
|
3 | 3 | import devkor.com.teamcback.domain.vote.dto.response.ChangeVoteStatusRes; |
| 4 | +import devkor.com.teamcback.domain.vote.dto.response.CreatePlaceVoteRes; |
4 | 5 | import devkor.com.teamcback.domain.vote.dto.response.GetVoteRes; |
5 | 6 | import devkor.com.teamcback.domain.vote.entity.VoteStatus; |
6 | 7 | import devkor.com.teamcback.domain.vote.service.VoteService; |
|
15 | 16 | import lombok.RequiredArgsConstructor; |
16 | 17 | import org.springframework.web.bind.annotation.*; |
17 | 18 |
|
| 19 | +import java.util.List; |
| 20 | + |
18 | 21 | @RestController |
19 | 22 | @RequiredArgsConstructor |
20 | 23 | @RequestMapping("/api/admin/votes") |
@@ -59,4 +62,38 @@ public CommonResponse<CursorPageRes<GetVoteRes>> getVoteList( |
59 | 62 | ) { |
60 | 63 | return CommonResponse.success(voteService.getVoteList(status, lastVoteId, size)); |
61 | 64 | } |
| 65 | + |
| 66 | + /** |
| 67 | + * 득표 수 많은 투표 조회 |
| 68 | + */ |
| 69 | + @Operation(summary = "득표 수 많은 투표 조회", description = "득표 수 20 이상인 투표 조회") |
| 70 | + @ApiResponses(value = { |
| 71 | + @ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."), |
| 72 | + @ApiResponse(responseCode = "404", description = "Not Found", |
| 73 | + content = @Content(schema = @Schema(implementation = CommonResponse.class))), |
| 74 | + }) |
| 75 | + @GetMapping("/major") |
| 76 | + public CommonResponse<List<GetVoteRes>> getMajorVoteList( |
| 77 | + @Parameter(description = "투표 상태", example = "REFLECTED") |
| 78 | + @RequestParam(name = "status", required = false) VoteStatus status |
| 79 | + ) { |
| 80 | + return CommonResponse.success(voteService.getMajorVoteList(status)); |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * 장소에 투표 생성(일괄) |
| 85 | + */ |
| 86 | + @Operation(summary = "장소에 투표 생성(일괄)", description = "생성 원하는 투표 주제 id 입력") |
| 87 | + @ApiResponses(value = { |
| 88 | + @ApiResponse(responseCode = "200", description = "정상 처리 되었습니다."), |
| 89 | + @ApiResponse(responseCode = "404", description = "Not Found", |
| 90 | + content = @Content(schema = @Schema(implementation = CommonResponse.class))), |
| 91 | + }) |
| 92 | + @PostMapping("/topics/{voteTopicId}") |
| 93 | + public CommonResponse<CreatePlaceVoteRes> createPlaceVote( |
| 94 | + @Parameter(description = "투표 주제 ID", example = "1") |
| 95 | + @PathVariable(name = "voteTopicId") Long voteTopicId) { |
| 96 | + return CommonResponse.success(voteService.createPlaceVote(voteTopicId)); |
| 97 | + } |
| 98 | + |
62 | 99 | } |
0 commit comments