|
1 | 1 | package grep.neogul_coder.domain.timevote.controller; |
2 | 2 |
|
3 | | -import grep.neogul_coder.domain.timevote.dto.request.*; |
4 | | -import grep.neogul_coder.domain.timevote.dto.response.*; |
| 3 | +import grep.neogul_coder.domain.timevote.dto.request.TimeVoteCreateRequest; |
| 4 | +import grep.neogul_coder.domain.timevote.dto.request.TimeVoteDeleteRequest; |
| 5 | +import grep.neogul_coder.domain.timevote.dto.request.TimeVotePeriodCreateRequest; |
| 6 | +import grep.neogul_coder.domain.timevote.dto.request.TimeVoteUpdateRequest; |
| 7 | +import grep.neogul_coder.domain.timevote.dto.response.TimeVotePeriodResponse; |
| 8 | +import grep.neogul_coder.domain.timevote.dto.response.TimeVoteResponse; |
| 9 | +import grep.neogul_coder.domain.timevote.dto.response.TimeVoteStatListResponse; |
| 10 | +import grep.neogul_coder.domain.timevote.dto.response.TimeVoteSubmissionStatusResponse; |
| 11 | +import grep.neogul_coder.domain.timevote.service.TimeVotePeriodService; |
| 12 | +import grep.neogul_coder.global.auth.Principal; |
5 | 13 | import grep.neogul_coder.global.response.ApiResponse; |
6 | 14 | import jakarta.validation.Valid; |
| 15 | +import java.util.Collections; |
7 | 16 | import java.util.List; |
8 | | -import org.springframework.web.bind.annotation.*; |
| 17 | +import lombok.RequiredArgsConstructor; |
| 18 | +import org.springframework.security.core.annotation.AuthenticationPrincipal; |
| 19 | +import org.springframework.web.bind.annotation.DeleteMapping; |
| 20 | +import org.springframework.web.bind.annotation.GetMapping; |
| 21 | +import org.springframework.web.bind.annotation.PathVariable; |
| 22 | +import org.springframework.web.bind.annotation.PostMapping; |
| 23 | +import org.springframework.web.bind.annotation.PutMapping; |
| 24 | +import org.springframework.web.bind.annotation.RequestBody; |
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 26 | +import org.springframework.web.bind.annotation.RestController; |
9 | 27 |
|
10 | 28 | @RestController |
| 29 | +@RequiredArgsConstructor |
11 | 30 | @RequestMapping("/api/studies/{studyId}/time-vote") |
12 | 31 | public class TimeVoteController implements TimeVoteSpecification { |
13 | 32 |
|
| 33 | + private final TimeVotePeriodService timeVotePeriodService; |
| 34 | + |
14 | 35 | @PostMapping("/periods") |
15 | 36 | public ApiResponse<TimeVotePeriodResponse> createPeriod( |
16 | 37 | @PathVariable("studyId") Long studyId, |
17 | | - @RequestBody @Valid TimeVotePeriodCreateRequest request |
18 | | - ) { |
19 | | - return ApiResponse.success(new TimeVotePeriodResponse()); |
20 | | - } |
21 | | - |
22 | | - @GetMapping("/periods/{periodId}/stats") |
23 | | - public ApiResponse<List<TimeVoteStatResponse>> getVoteStats( |
24 | | - @PathVariable("studyId") Long studyId, |
25 | | - @PathVariable("periodId") Long periodId |
| 38 | + @RequestBody @Valid TimeVotePeriodCreateRequest request, |
| 39 | + @AuthenticationPrincipal Principal userDetails |
26 | 40 | ) { |
27 | | - return ApiResponse.success(List.of(new TimeVoteStatResponse())); |
| 41 | + return ApiResponse.success(new TimeVotePeriodResponse()); // mock response |
28 | 42 | } |
29 | 43 |
|
30 | | - @PostMapping("/single") |
| 44 | + @PostMapping("/votes") |
31 | 45 | public ApiResponse<TimeVoteResponse> submitVote( |
32 | 46 | @PathVariable("studyId") Long studyId, |
33 | | - @RequestBody @Valid TimeVoteCreateRequest request |
34 | | - ) { |
35 | | - return ApiResponse.success(new TimeVoteResponse()); |
36 | | - } |
37 | | - |
38 | | - @PostMapping("/bulk") |
39 | | - public ApiResponse<List<TimeVoteResponse>> submitVotes( |
40 | | - @PathVariable("studyId") Long studyId, |
41 | | - @RequestBody @Valid TimeVoteBulkCreateRequest request |
| 47 | + @RequestBody @Valid TimeVoteCreateRequest request, |
| 48 | + @AuthenticationPrincipal Principal userDetails |
42 | 49 | ) { |
43 | | - return ApiResponse.success(List.of(new TimeVoteResponse())); |
| 50 | + return ApiResponse.success(new TimeVoteResponse()); // mock response |
44 | 51 | } |
45 | 52 |
|
46 | | - @PutMapping("/single") |
| 53 | + @PutMapping("/votes") |
47 | 54 | public ApiResponse<TimeVoteResponse> updateVote( |
48 | 55 | @PathVariable("studyId") Long studyId, |
49 | | - @RequestBody @Valid TimeVoteUpdateRequest request |
50 | | - ) { |
51 | | - return ApiResponse.success(new TimeVoteResponse()); |
52 | | - } |
53 | | - |
54 | | - @PutMapping("/bulk") |
55 | | - public ApiResponse<List<TimeVoteResponse>> updateVotes( |
56 | | - @PathVariable("studyId") Long studyId, |
57 | | - @RequestBody @Valid TimeVoteBulkUpdateRequest request |
| 56 | + @RequestBody @Valid TimeVoteUpdateRequest request, |
| 57 | + @AuthenticationPrincipal Principal userDetails |
58 | 58 | ) { |
59 | | - return ApiResponse.success(List.of(new TimeVoteResponse())); |
| 59 | + return ApiResponse.success(new TimeVoteResponse()); // mock response |
60 | 60 | } |
61 | 61 |
|
62 | | - |
63 | | - @DeleteMapping("/single") |
64 | | - public ApiResponse<Void> deleteVotes( |
| 62 | + @DeleteMapping("/votes") |
| 63 | + public ApiResponse<Void> deleteAllVotes( |
65 | 64 | @PathVariable("studyId") Long studyId, |
66 | | - @RequestBody @Valid TimeVoteDeleteRequest request |
| 65 | + @RequestBody @Valid TimeVoteDeleteRequest request, |
| 66 | + @AuthenticationPrincipal Principal userDetails |
67 | 67 | ) { |
68 | | - return ApiResponse.noContent(); |
| 68 | + return ApiResponse.noContent(); // mock response |
69 | 69 | } |
70 | 70 |
|
71 | | - @DeleteMapping("/bulk") |
72 | | - public ApiResponse<Void> deleteMultipleVotes( |
| 71 | + @GetMapping("/periods/stats") |
| 72 | + public ApiResponse<TimeVoteStatListResponse> getVoteStats( |
73 | 73 | @PathVariable("studyId") Long studyId, |
74 | | - @RequestBody @Valid TimeVoteBulkDeleteRequest request |
| 74 | + @AuthenticationPrincipal Principal userDetails |
75 | 75 | ) { |
76 | | - return ApiResponse.noContent(); |
| 76 | + return ApiResponse.success(new TimeVoteStatListResponse()); // mock response |
77 | 77 | } |
78 | 78 |
|
79 | | - @DeleteMapping("/all") |
80 | | - public ApiResponse<Void> deleteAllVotes( |
| 79 | + @GetMapping("/periods/submissions") |
| 80 | + public ApiResponse<List<TimeVoteSubmissionStatusResponse>> getSubmissionStatusList( |
81 | 81 | @PathVariable("studyId") Long studyId, |
82 | | - @RequestParam("periodId") Long periodId, |
83 | | - @RequestParam("studyMemberId") Long studyMemberId |
| 82 | + @AuthenticationPrincipal Principal userDetails |
84 | 83 | ) { |
85 | | - return ApiResponse.noContent(); |
| 84 | + return ApiResponse.success(Collections.emptyList()); // mock response |
86 | 85 | } |
87 | 86 | } |
0 commit comments