-
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.
Refactor: 이번달 러닝 서머리 V2를 위한 코드 리팩터링(임시)
- V2, V1 공통 리스펀스 DTO RunningRecordMonthlySummaryResponse로 지정(이번달, 이번달 달린 거리) - V1 리스펀스 추가 - 서비스 로직 변경 - 컨트롤러에서 값 가공후 V1으로 리턴
- Loading branch information
Showing
5 changed files
with
51 additions
and
55 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
21 changes: 5 additions & 16 deletions
21
...m/dnd/runus/presentation/v1/running/dto/response/RunningRecordMonthlySummaryResponse.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,24 +1,13 @@ | ||
package com.dnd.runus.presentation.v1.running.dto.response; | ||
|
||
import static com.dnd.runus.global.constant.MetricsConversionFactor.METERS_IN_A_KILOMETER; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import java.text.DecimalFormat; | ||
import lombok.Builder; | ||
|
||
//todo API 버저닝 관련 구조 정해지면 패키지 변경 예쩡 | ||
@Builder | ||
public record RunningRecordMonthlySummaryResponse( | ||
@Schema(description = "이번 달", example = "8월") | ||
String month, | ||
@Schema(description = "이번 달에 달린 키로 수", example = "2.55km") | ||
String monthlyKm, | ||
@Schema(description = "다음 레벨", example = "Level 2") | ||
String nextLevelName, | ||
@Schema(description = "다음 레벨까지 남은 키로 수", example = "2.55km") | ||
String nextLevelKm | ||
int month, | ||
int monthlyTotalMeter | ||
) { | ||
private static final DecimalFormat KILO_METER_FORMATTER = new DecimalFormat("0.##km"); | ||
|
||
public RunningRecordMonthlySummaryResponse(int monthValue, int monthlyTotalMeter, String nextLevelName, String nextLevelKm) { | ||
this(monthValue + "월", KILO_METER_FORMATTER.format(monthlyTotalMeter / METERS_IN_A_KILOMETER), nextLevelName, nextLevelKm); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...dnd/runus/presentation/v1/running/dto/response/RunningRecordMonthlySummaryResponseV1.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,23 @@ | ||
package com.dnd.runus.presentation.v1.running.dto.response; | ||
|
||
import static com.dnd.runus.global.constant.MetricsConversionFactor.METERS_IN_A_KILOMETER; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.text.DecimalFormat; | ||
|
||
public record RunningRecordMonthlySummaryResponseV1( | ||
@Schema(description = "이번 달", example = "8월") | ||
String month, | ||
@Schema(description = "이번 달에 달린 키로 수", example = "2.55km") | ||
String monthlyKm, | ||
@Schema(description = "다음 레벨", example = "Level 2") | ||
String nextLevelName, | ||
@Schema(description = "다음 레벨까지 남은 키로 수", example = "2.55km") | ||
String nextLevelKm | ||
) { | ||
private static final DecimalFormat KILO_METER_FORMATTER = new DecimalFormat("0.##km"); | ||
|
||
public RunningRecordMonthlySummaryResponseV1(int monthValue, int monthlyTotalMeter, String nextLevelName, String nextLevelKm) { | ||
this(monthValue + "월", KILO_METER_FORMATTER.format(monthlyTotalMeter / METERS_IN_A_KILOMETER), nextLevelName, nextLevelKm); | ||
} | ||
} |
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