-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 보행 훈련 기록 조회 API에 정확도 평균 정보 추가 완료 (#95)
- Loading branch information
Showing
10 changed files
with
278 additions
and
143 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
23 changes: 23 additions & 0 deletions
23
stempo-application/src/main/java/com/stempo/dto/response/RecordItemDto.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.stempo.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDate; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class RecordItemDto { | ||
|
||
@Schema(description = "정확도", example = "0.0") | ||
private Double accuracy; | ||
|
||
@Schema(description = "재활 운동 시간(초)", example = "0") | ||
private Integer duration; | ||
|
||
@Schema(description = "걸음 수", example = "0") | ||
private Integer steps; | ||
|
||
@Schema(description = "날짜", example = "2024-01-01") | ||
private LocalDate date; | ||
} |
25 changes: 14 additions & 11 deletions
25
stempo-application/src/main/java/com/stempo/dto/response/RecordResponseDto.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,23 +1,26 @@ | ||
package com.stempo.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class RecordResponseDto { | ||
|
||
@Schema(description = "정확도", example = "0.0") | ||
private Double accuracy; | ||
@Schema(description = "정확도 평균", example = "0") | ||
private Integer accuracyAverage; | ||
|
||
@Schema(description = "재활 운동 시간(초)", example = "0") | ||
private Integer duration; | ||
|
||
@Schema(description = "걸음 수", example = "0") | ||
private Integer steps; | ||
|
||
@Schema(description = "날짜", example = "2024-01-01") | ||
private LocalDate date; | ||
@Schema(description = "보행 훈련 기록", example = """ | ||
[ | ||
{ | ||
"accuracy": 0.0, | ||
"duration": 0, | ||
"steps": 0, | ||
"date": "2025-01-01" | ||
} | ||
] | ||
""") | ||
private List<RecordItemDto> records; | ||
} |
31 changes: 20 additions & 11 deletions
31
stempo-application/src/main/java/com/stempo/mapper/RecordDtoMapper.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,28 +1,37 @@ | ||
package com.stempo.mapper; | ||
|
||
import com.stempo.dto.response.RecordItemDto; | ||
import com.stempo.dto.response.RecordResponseDto; | ||
import com.stempo.dto.response.RecordStatisticsResponseDto; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class RecordDtoMapper { | ||
|
||
public RecordResponseDto toDto(Double accuracy, Integer duration, Integer steps, LocalDate date) { | ||
public RecordResponseDto toDto(int accuracyAverage, List<RecordItemDto> records) { | ||
return RecordResponseDto.builder() | ||
.accuracy(accuracy) | ||
.duration(duration) | ||
.steps(steps) | ||
.date(date) | ||
.build(); | ||
.accuracyAverage(accuracyAverage) | ||
.records(records) | ||
.build(); | ||
} | ||
|
||
public RecordItemDto toDto(Double accuracy, Integer duration, Integer steps, LocalDate date) { | ||
return RecordItemDto.builder() | ||
.accuracy(accuracy) | ||
.duration(duration) | ||
.steps(steps) | ||
.date(date) | ||
.build(); | ||
} | ||
|
||
public RecordStatisticsResponseDto toDto(int todayWalkTrainingCount, int weeklyWalkTrainingCount, | ||
int consecutiveWalkTrainingDays) { | ||
int consecutiveWalkTrainingDays) { | ||
return RecordStatisticsResponseDto.builder() | ||
.todayWalkTrainingCount(todayWalkTrainingCount) | ||
.weeklyWalkTrainingCount(weeklyWalkTrainingCount) | ||
.consecutiveWalkTrainingDays(consecutiveWalkTrainingDays) | ||
.build(); | ||
.todayWalkTrainingCount(todayWalkTrainingCount) | ||
.weeklyWalkTrainingCount(weeklyWalkTrainingCount) | ||
.consecutiveWalkTrainingDays(consecutiveWalkTrainingDays) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.