-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix: 이번주 날짜 응답 형식을 yyyy.MM.dd ~ yyyy.MM.dd로 변경 * Test: 필요없는 테스트 코드 삭제 * Feat: 요일별 활동 기록 DTO 추가 * Fix: 요일 별 활동 응답 형식을 double[]에서 List<WeeklyRunningRatingDto>로 변경 * Docs: 응답형식 변경으로 api docs 수정 * Style: 주석 괄호 밖으로 이동
- Loading branch information
Showing
5 changed files
with
46 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/dnd/runus/presentation/v1/running/dto/WeeklyRunningRatingDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.dnd.runus.presentation.v1.running.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record WeeklyRunningRatingDto( | ||
@Schema(description = "요일", example = "월") | ||
String day, | ||
@Schema(description = "거리는 km, 시간은 시간(Hour) 단위, 기록없으면 0") | ||
double rating | ||
) { | ||
} |
21 changes: 9 additions & 12 deletions
21
...om/dnd/runus/presentation/v1/running/dto/response/RunningRecordWeeklySummaryResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
package com.dnd.runus.presentation.v1.running.dto.response; | ||
|
||
import com.dnd.runus.presentation.v1.running.dto.WeeklyRunningRatingDto; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDate; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
|
||
public record RunningRecordWeeklySummaryResponse( | ||
@Schema(description = "이번주 날짜", example = "2024.09.09 ~ 09.15") | ||
String date, | ||
@Schema(description = "요일 별 활동 값, 거리는 km, 시간은 시간(Hour) 단위<br>" | ||
+ "월요일(index:0) ~ 일요일(index:6)의 값, 기록없는 날은 0을 리턴") | ||
double[] weeklyValues, | ||
@Schema(description = "이번주 날짜", example = "2024.09.09 ~ 2024.09.15") | ||
String weeklyDate, | ||
@Schema(description = "요일 별 활동 값<br>" | ||
+ "월 ~ 일 순서로 리턴") | ||
List<WeeklyRunningRatingDto> weeklyValues, | ||
@Schema(description = "지난주 평균 활동 값, 거리는 km, 시간은 시간(Hour) 단위<br>" | ||
+ "지난주에 기록이 없으면 0을 리턴") | ||
double lastWeekAvgValue | ||
) { | ||
public RunningRecordWeeklySummaryResponse(LocalDate startDate, LocalDate endDate, double[] weeklyValues, double lastWeekAvgValue) { | ||
public RunningRecordWeeklySummaryResponse(LocalDate startDate, LocalDate endDate, List<WeeklyRunningRatingDto> weeklyValues, double lastWeekAvgValue) { | ||
this(dateFormat(startDate, endDate), weeklyValues, lastWeekAvgValue); | ||
} | ||
|
||
private static String dateFormat(LocalDate startDate, LocalDate endDate) { | ||
DateTimeFormatter yyyyMMddFormatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); | ||
String formattedStartDate = startDate.format(yyyyMMddFormatter); | ||
String formattedEndDate = endDate.format(DateTimeFormatter.ofPattern("MM.dd")); | ||
if (startDate.getYear() != endDate.getYear()) { | ||
//연도가 다를 경우 yyyy.MM.dd ~ yyyy.MM.dd | ||
formattedEndDate = endDate.format(yyyyMMddFormatter); | ||
} | ||
//yyyy.MM.dd ~ MM.dd 로 리턴 | ||
String formattedEndDate = endDate.format(yyyyMMddFormatter); | ||
return formattedStartDate + " ~ " + formattedEndDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters