77import java .time .LocalDateTime ;
88import java .util .List ;
99
10- /**
11- * ✅ WeeklyStatusResponse
12- *
13- * 용도
14- * - 홈 화면 "주간 요약" API 응답 모델.
15- * - 총 주행 시간, 평균 점수, 일자별 합계(차트용), 최근 주행 요약을 포함합니다.
16- *
17- * 기간 규칙
18- * - [from, to) 반개구간을 사용합니다. (from 이상, to 미만)
19- * - 컨트롤러/서비스에서 타임존 경계(자정)를 맞춘 뒤 값을 채워 넣습니다.
20- *
21- * 구성
22- * - from / to : 조회 기간 경계
23- * - totalSeconds : 기간 내 총 주행 시간(초)
24- * - averageScore : 기간 내 평균 점수 (null 가능)
25- * - dailySeconds : 일자별 총 주행 시간 버킷(차트/스파크라인 등 UI에 사용)
26- * - lastDriving : 최근 주행 1건 요약(선택 정보)
27- */
2810@ Getter
2911@ Setter
3012@ NoArgsConstructor
3113@ AllArgsConstructor
3214@ Builder
3315public class WeeklyStatusResponse {
3416
35- @ Schema (description = "기간 시작 (포함)" , example = "2025-09-22T00:00:00" )
17+ @ Schema (description = "기간 시작 (포함)" )
3618 private LocalDateTime from ;
3719
38- @ Schema (description = "기간 끝 (미포함)" , example = "2025-09-29T00:00:00" )
20+ @ Schema (description = "기간 끝 (미포함)" )
3921 private LocalDateTime to ;
4022
41- @ Schema (description = "총 주행 시간(초)" , example = "7380 " )
23+ @ Schema (description = "기간 내 총 주행 시간(초)" )
4224 private int totalSeconds ;
4325
44- @ Schema (description = "평균 점수(null 가능)" , example = "83.4" )
26+ @ Schema (description = "기간 내 총 주행 횟수" ) // (추가)
27+ private long totalDrivingCount ;
28+
29+ @ Schema (description = "기간 내 총 이벤트 발생 횟수" ) // (추가)
30+ private long totalEventCount ;
31+
32+ @ Schema (description = "기간 내 평균 점수 (null 가능)" )
4533 private Double averageScore ;
4634
4735 @ Schema (description = "일자별 총 주행(초) 버킷" )
@@ -50,46 +38,19 @@ public class WeeklyStatusResponse {
5038 @ Schema (description = "가장 최근 주행 요약(선택)" )
5139 private LastDriving lastDriving ;
5240
53- /* ---------- 하위 타입 ---------- */
41+ // ... (DayBucket, LastDriving 내부 클래스는 기존 코드 그대로 유지) ...
42+ public static record DayBucket (LocalDate date , int seconds ) {}
5443
55- /**
56- * 📅 DayBucket
57- * - 특정 날짜(LocalDate)와 그 날짜의 총 주행 시간(초)
58- * - Java 16+ record 로 간결하게 정의 (불변)
59- * - 사용 예: new DayBucket(LocalDate.of(2025,9,28), 1800)
60- */
61- public static record DayBucket (
62- @ Schema (description = "날짜" , example = "2025-09-28" )
63- LocalDate date ,
64- @ Schema (description = "해당 날짜의 총 주행 시간(초)" , example = "1800" )
65- int seconds
66- ) {}
67-
68- /**
69- * 🚘 LastDriving
70- * - 최근 주행 1건에 대한 요약 정보
71- * - 목록에서 상단 카드나 홈 위젯으로 노출할 때 사용
72- */
7344 @ Getter
7445 @ Setter
7546 @ NoArgsConstructor
7647 @ AllArgsConstructor
7748 @ Builder
7849 public static class LastDriving {
79-
80- @ Schema (description = "주행 기록 ID" , example = "321" )
8150 private Long recordId ;
82-
83- @ Schema (description = "시작 시각" , example = "2025-09-28T10:00:00" )
8451 private LocalDateTime startTime ;
85-
86- @ Schema (description = "종료 시각" , example = "2025-09-28T10:45:12" )
8752 private LocalDateTime endTime ;
88-
89- @ Schema (description = "총 주행 시간(초)" , example = "2712" )
9053 private Integer totalSeconds ;
91-
92- @ Schema (description = "운전 점수(0~100, null 가능)" , example = "87.5" )
9354 private Float score ;
9455 }
95- }
56+ }
0 commit comments