From 853133d744b82a530ea6910addee67a697971521 Mon Sep 17 00:00:00 2001 From: 1Seob Date: Wed, 14 Jan 2026 18:35:04 +0900 Subject: [PATCH] =?UTF-8?q?refactor(report):=20=EB=82=98=EC=9D=98=20?= =?UTF-8?q?=EC=A3=BC=EA=B0=84/=EC=9B=94=EA=B0=84=20=EB=A6=AC=ED=8F=AC?= =?UTF-8?q?=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20API=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이번 리포트의 경우 status를 그대로 응답에 포함 --- .../monthlyreport/api/MonthlyReportController.java | 8 ++++++-- .../application/MonthlyReportQueryService.java | 5 ++--- .../domain/weeklyreport/api/WeeklyReportController.java | 9 +++++++-- .../application/WeeklyReportQueryService.java | 8 +++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/api/MonthlyReportController.java b/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/api/MonthlyReportController.java index 481d209..88cd702 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/api/MonthlyReportController.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/api/MonthlyReportController.java @@ -90,8 +90,12 @@ public ResponseEntity> startMonthlyRe description = """ 사용자의 (지난 달에 대한) 월간 리포트와 이전 월간 리포트를 조회합니다.
이때 ```report```혹은 ```previousReport```가 ```null```인 경우 해당 주간 리포트가 존재하지 않음을 의미합니다.
- ```report```혹은 ```previousReport```가 - ```null```이 아닌 경우 ```status```필드는 항상 ```COMPLETED```입니다. + ```previousReport```가 ```null```이 아닌 경우 ```status```필드는 항상 ```COMPLETED```입니다.
+ **<```report```의 state>**
+ 생성 대기 중인 경우 ```status = "PENDING"``` 으로 반환됩니다.
+ 생성 진행 중인 경우 ```status = "IN_PROGRESS"``` 로 반환됩니다.
+ 생성에 성공한 경우 ```status = "COMPLETED"``` 로 반환됩니다.
+ 생성에 실패한 경우 ```status = "FAILED"``` 로 반환됩니다. 이때 크리스탈이 환불되기 때문에 잔액 조회를 해야합니다. """, security = @SecurityRequirement(name = "bearerAuth"), responses = { diff --git a/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/application/MonthlyReportQueryService.java b/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/application/MonthlyReportQueryService.java index 841d7f2..9e02c81 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/application/MonthlyReportQueryService.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/monthlyreport/application/MonthlyReportQueryService.java @@ -30,10 +30,9 @@ public MyMonthlyReportResponse getMyMonthlyReport(Long userId) { MonthRangeDto range = MonthRangeCalculator.getLastMonthRange(); MonthlyReportResponse reportResponse = - monthlyReportRepository.findByUserIdAndMonthStartDateAndStatus( + monthlyReportRepository.findByUserIdAndMonthStartDate( user.getId(), - range.monthStartDate(), - MonthlyReportStatus.COMPLETED + range.monthStartDate() ) .map(report -> MonthlyReportMapper.toResponse(range, report)) .orElse(null); diff --git a/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/api/WeeklyReportController.java b/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/api/WeeklyReportController.java index 11a55fa..b69980c 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/api/WeeklyReportController.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/api/WeeklyReportController.java @@ -90,8 +90,13 @@ public ResponseEntity> startWeeklyRepo description = """ 사용자의 (지난 주에 대한) 주간 리포트와 이전 주간 리포트를 조회합니다.
이때 ```report```혹은 ```previousReport```가 ```null```인 경우 해당 주간 리포트가 존재하지 않음을 의미합니다.
- ```report```혹은 ```previousReport```가 - ```null```이 아닌 경우 ```status```필드는 항상 ```COMPLETED```입니다. + ```previousReport```가 ```null```이 아닌 경우 ```status```필드는 항상 ```COMPLETED```입니다.
+ **<```report```의 state>**
+ 생성 대기 중인 경우 ```status = "PENDING"``` 으로 반환됩니다.
+ 생성 진행 중인 경우 ```status = "IN_PROGRESS"``` 로 반환됩니다.
+ 생성에 성공한 경우 ```status = "COMPLETED"``` 로 반환됩니다.
+ 생성에 실패한 경우 ```status = "FAILED"``` 로 반환됩니다. 이때 크리스탈이 환불되기 때문에 잔액 조회를 해야합니다. + """, security = @SecurityRequirement(name = "bearerAuth"), responses = { diff --git a/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/application/WeeklyReportQueryService.java b/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/application/WeeklyReportQueryService.java index 5c55662..a21ade1 100644 --- a/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/application/WeeklyReportQueryService.java +++ b/src/main/java/com/devkor/ifive/nadab/domain/weeklyreport/application/WeeklyReportQueryService.java @@ -30,15 +30,13 @@ public MyWeeklyReportResponse getMyWeeklyReport(Long userId) { WeekRangeDto range = WeekRangeCalculator.getLastWeekRange(); WeeklyReportResponse reportResponse = - weeklyReportRepository.findByUserIdAndWeekStartDateAndStatus( - user.getId(), - range.weekStartDate(), - WeeklyReportStatus.COMPLETED + weeklyReportRepository.findByUserAndWeekStartDate( + user, + range.weekStartDate() ). map(report -> WeeklyReportMapper.toResponse(range, report)) .orElse(null); - WeekRangeDto prevRange = WeekRangeCalculator.getTwoWeeksAgoRange(); WeeklyReportResponse prevReportResponse = weeklyReportRepository.findByUserIdAndWeekStartDateAndStatus(