Skip to content

Commit

Permalink
feat: 코스 기록 시 duration 필드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
junseokkim committed Dec 14, 2024
1 parent 1d87751 commit 73d8876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -59,6 +60,8 @@ public static class CreateCourseRecordRequest {
@NotNull(message = "평균 페이스를 입력해주세요.")
private Double averagePace;

private long duration;

@NotNull(message = "소모 칼로리를 입력해주세요.")
private Integer caloriesBurned;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public CourseRecord toCourseRecord(Course course, Member member, CourseRequest.C
.runner(member)
.startTime(request.getStartTime())
.endTime(request.getEndTime())
.duration(Duration.between(request.getStartTime(), request.getEndTime()))
.duration(Duration.ofSeconds(request.getDuration()))
.distance(request.getDistance())
.averagePace(request.getAveragePace())
.caloriesBurned(request.getCaloriesBurned())
Expand Down

0 comments on commit 73d8876

Please sign in to comment.