Skip to content

Commit a0200cb

Browse files
committed
fix: 초단위 절삭에서 분단위 절삭으로 수정
1 parent 650f22c commit a0200cb

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

src/main/java/com/back/domain/study/plan/dto/StudyPlanRequest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ public class StudyPlanRequest {
2828

2929
// RepeatRule 중첩 객체
3030
private RepeatRuleRequest repeatRule;
31-
// LocalDateTime을 단위로 자르기 위한 setter
31+
// LocalDateTime을 단위로 자르기 위한 setter
3232
public void setStartDate(LocalDateTime startDate) {
33-
this.startDate = startDate != null ? startDate.truncatedTo(ChronoUnit.SECONDS) : null;
33+
this.startDate = startDate != null ? startDate.truncatedTo(ChronoUnit.MINUTES) : null;
3434
}
3535
public void setEndDate(LocalDateTime endDate) {
36-
this.endDate = endDate != null ? endDate.truncatedTo(ChronoUnit.SECONDS) : null;
36+
this.endDate = endDate != null ? endDate.truncatedTo(ChronoUnit.MINUTES) : null;
3737
}
3838

39-
// 단위로 자른 값을 생성자에서도 설정
39+
// 단위로 자른 값을 생성자에서도 설정
4040
public StudyPlanRequest(String subject, LocalDateTime startDate, LocalDateTime endDate,
4141
Color color, RepeatRuleRequest repeatRule) {
4242
this.subject = subject;
43-
this.startDate = startDate != null ? startDate.truncatedTo(ChronoUnit.SECONDS) : null;
44-
this.endDate = endDate != null ? endDate.truncatedTo(ChronoUnit.SECONDS) : null;
43+
this.startDate = startDate != null ? startDate.truncatedTo(ChronoUnit.MINUTES) : null;
44+
this.endDate = endDate != null ? endDate.truncatedTo(ChronoUnit.MINUTES) : null;
4545
this.color = color;
4646
this.repeatRule = repeatRule;
4747
}

src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,25 @@ void t1() throws Exception {
168168

169169
}
170170

171+
@Test
172+
@DisplayName("단발성 계획 생성 - 밀리초까지 전송받는 경우")
173+
void t1_1() throws Exception {
174+
175+
ResultActions resultActions = mvc.perform(post("/api/plans")
176+
.header("Authorization", "Bearer faketoken")
177+
.contentType(MediaType.APPLICATION_JSON)
178+
.content("""
179+
{
180+
"subject": "단발성 계획 - 밀리초 포함",
181+
"startDate": "2025-09-21T05:00:00.000Z",
182+
"endDate": "2025-09-21T07:00:00.000Z",
183+
"color": "RED"
184+
}
185+
"""))
186+
.andDo(print());
187+
188+
}
189+
171190
@Test
172191
@DisplayName("반복성 계획 생성")
173192
void t2() throws Exception {

0 commit comments

Comments
 (0)