|
3 | 3 | import com.example.dosirakbe.domain.auth.dto.response.CustomOAuth2User;
|
4 | 4 | import com.example.dosirakbe.domain.user_activity.dto.response.UserActivityResponse;
|
5 | 5 | import com.example.dosirakbe.domain.user_activity.service.UserActivityService;
|
6 |
| -import com.example.dosirakbe.global.api.ApiResponseWrapper; |
7 | 6 | import com.example.dosirakbe.global.util.ApiResult;
|
| 7 | +import com.example.dosirakbe.global.util.StatusEnum; |
8 | 8 | import lombok.RequiredArgsConstructor;
|
9 | 9 | import org.springframework.format.annotation.DateTimeFormat;
|
10 | 10 | import org.springframework.http.HttpStatus;
|
| 11 | +import org.springframework.http.ResponseEntity; |
11 | 12 | import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
12 | 13 | import org.springframework.web.bind.annotation.GetMapping;
|
13 | 14 | import org.springframework.web.bind.annotation.RequestMapping;
|
@@ -48,14 +49,24 @@ public class UserActivityController {
|
48 | 49 | * @return 월간 활동 요약을 포함하는 {@link ApiResult} 형태의 {@link List} 객체
|
49 | 50 | */
|
50 | 51 | @GetMapping("/monthly")
|
51 |
| - @ApiResponseWrapper(status = HttpStatus.OK, message = "Monthly Activity summary retrieved successfully") |
52 |
| - public Object getMonthlyActivitySummary(@AuthenticationPrincipal CustomOAuth2User customOAuth2User, |
53 |
| - @RequestParam(value = "month", required = false) @DateTimeFormat(pattern = "yyyy-MM") YearMonth month) { |
| 52 | + public ResponseEntity<ApiResult<List<UserActivityResponse>>> getMonthlyActivitySummary(@AuthenticationPrincipal CustomOAuth2User customOAuth2User, |
| 53 | + @RequestParam(value = "month", required = false) @DateTimeFormat(pattern = "yyyy-MM") YearMonth month) { |
| 54 | + |
54 | 55 | Long userId = getUserIdByOAuth(customOAuth2User);
|
55 | 56 |
|
56 | 57 | YearMonth targetMonth = Objects.nonNull(month) ? month : YearMonth.now();
|
57 | 58 |
|
58 |
| - return userActivityService.getUserActivityList(userId, targetMonth); |
| 59 | + List<UserActivityResponse> monthlySummary = userActivityService.getUserActivityList(userId, targetMonth); |
| 60 | + |
| 61 | + ApiResult<List<UserActivityResponse>> result = ApiResult.<List<UserActivityResponse>>builder() |
| 62 | + .status(StatusEnum.SUCCESS) |
| 63 | + .message("Monthly Activity summary retrieved successfully") |
| 64 | + .data(monthlySummary) |
| 65 | + .build(); |
| 66 | + |
| 67 | + return ResponseEntity |
| 68 | + .status(HttpStatus.OK) |
| 69 | + .body(result); |
59 | 70 | }
|
60 | 71 |
|
61 | 72 | /**
|
|
0 commit comments