|
1 | 1 | package MathCaptain.weakness.domain.Record.controller; |
2 | 2 |
|
3 | | -import MathCaptain.weakness.domain.Record.dto.request.recordEndRequest; |
| 3 | +import MathCaptain.weakness.domain.Record.dto.request.FitnessLogEnrollRequest; |
| 4 | +import MathCaptain.weakness.domain.Record.dto.request.RecordEndRequest; |
| 5 | +import MathCaptain.weakness.domain.Record.dto.request.RunningLogEnrollRequest; |
| 6 | +import MathCaptain.weakness.domain.Record.dto.request.StudyLogEnrollRequest; |
4 | 7 | import MathCaptain.weakness.domain.Record.dto.response.RecordSummaryResponse; |
5 | 8 | import MathCaptain.weakness.domain.Record.service.RecordService; |
6 | 9 | import MathCaptain.weakness.domain.User.entity.Users; |
|
10 | 13 | import lombok.RequiredArgsConstructor; |
11 | 14 | import org.springframework.web.bind.annotation.*; |
12 | 15 |
|
| 16 | +import static MathCaptain.weakness.domain.Group.enums.CategoryStatus.*; |
| 17 | + |
13 | 18 | @RestController |
14 | 19 | @RequiredArgsConstructor |
15 | | -@RequestMapping("/record/") |
| 20 | +@RequestMapping("/record") |
16 | 21 | public class RecordController { |
17 | 22 |
|
18 | 23 | private final RecordService recordService; |
19 | 24 |
|
20 | | - @PostMapping("/end/{groupId}") |
21 | | - public ApiResponse<RecordSummaryResponse> endActivity(@Valid @LoginUser Users loginUser, @PathVariable Long groupId, @RequestBody recordEndRequest requestDto) { |
22 | | - return ApiResponse.ok(recordService.endActivity(loginUser, groupId, requestDto)); |
| 25 | + @PostMapping("/end/fitness/{groupId}") |
| 26 | + public ApiResponse<RecordSummaryResponse> endFitnessActivity( |
| 27 | + @Valid @LoginUser Users loginUser, |
| 28 | + @PathVariable Long groupId, |
| 29 | + @RequestBody FitnessLogEnrollRequest logRequest) { |
| 30 | + return ApiResponse.ok(recordService.endActivity(loginUser, groupId, logRequest, FITNESS)); |
| 31 | + } |
| 32 | + |
| 33 | + @PostMapping("/end/running/{groupId}") |
| 34 | + public ApiResponse<RecordSummaryResponse> endRunningActivity( |
| 35 | + @Valid @LoginUser Users loginUser, |
| 36 | + @PathVariable Long groupId, |
| 37 | + @RequestBody RunningLogEnrollRequest logRequest) { |
| 38 | + return ApiResponse.ok(recordService.endActivity(loginUser, groupId, logRequest, RUNNING)); |
| 39 | + } |
| 40 | + |
| 41 | + @PostMapping("/end/study/{groupId}") |
| 42 | + public ApiResponse<RecordSummaryResponse> endStudyActivity( |
| 43 | + @Valid @LoginUser Users loginUser, |
| 44 | + @PathVariable Long groupId, |
| 45 | + @RequestBody StudyLogEnrollRequest logRequest) { |
| 46 | + return ApiResponse.ok(recordService.endActivity(loginUser, groupId, logRequest, STUDY)); |
23 | 47 | } |
24 | 48 | } |
0 commit comments