Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,26 @@ public class StudyPlanResponse {
@AllArgsConstructor
public static class RepeatRuleResponse {
private Frequency frequency;
private Integer repeatInterval;
private Integer intervalValue;
private List<DayOfWeek> byDay = new ArrayList<>(); // "MON" 형태의 enum 문자열 리스트

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate untilDate;

// 엔티티 생성자: 그대로 유지

// RepeatRule 엔티티를 DTO로 변환하는 생성자
// intervalValue의 경우 요청, 응답(프론트)에서는 intervalValue 사용
// 백엔드 내에서는 repeatInterval 사용
public RepeatRuleResponse(com.back.domain.study.plan.entity.RepeatRule repeatRule) {
if (repeatRule != null) {
this.frequency = repeatRule.getFrequency();
this.repeatInterval = repeatRule.getRepeatInterval();
this.intervalValue = repeatRule.getRepeatInterval();
this.byDay = repeatRule.getByDay();
this.untilDate = repeatRule.getUntilDate();
}
}

}
//엔티티를 DTO로 변환하는 생성자
// 엔티티를 DTO로 변환하는 생성자
public StudyPlanResponse(StudyPlan studyPlan) {
if (studyPlan != null) {
this.id = studyPlan.getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class RepeatRuleEmbeddable {
@Enumerated(EnumType.STRING)
private Frequency frequency;

private Integer intervalValue;
private Integer repeatInterval;
private List<DayOfWeek> byDay = new ArrayList<>();
private LocalDate untilDate; // LocalDateTime → LocalDate 변경
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public enum ExceptionType {
@Column(name = "modified_repeat_rule")
@AttributeOverrides({
@AttributeOverride(name = "frequency", column = @Column(name = "modified_frequency")),
@AttributeOverride(name = "intervalValue", column = @Column(name = "modified_repeat_interval")),
@AttributeOverride(name = "repeatInterval", column = @Column(name = "modified_interval_value")),
@AttributeOverride(name = "byDay", column = @Column(name = "modified_by_day")),
@AttributeOverride(name = "untilDate", column = @Column(name = "modified_until_date"))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ private boolean shouldRepeatOnDate(StudyPlan originalPlan, LocalDate targetDate)

case WEEKLY:
if (repeatRule.getByDay() != null && !repeatRule.getByDay().isEmpty()) {
String targetDayOfWeek = targetDate.getDayOfWeek().name().substring(0, 3);
// string으로 요일을 뽑아낸 뒤 enum으로 변환.
// 비교해서 포함되지 않으면 false
DayOfWeek targetDayOfWeek = DayOfWeek.valueOf(targetDate.getDayOfWeek().name().substring(0, 3));
if (!repeatRule.getByDay().contains(targetDayOfWeek)) {
return false;
}
Expand Down Expand Up @@ -259,7 +261,7 @@ private StudyPlanResponse createModifiedVirtualPlan(StudyPlan originalPlan, Stud
RepeatRuleEmbeddable modifiedRule = exception.getModifiedRepeatRule();
StudyPlanResponse.RepeatRuleResponse newRepeatRule = new StudyPlanResponse.RepeatRuleResponse();
newRepeatRule.setFrequency(modifiedRule.getFrequency());
newRepeatRule.setRepeatInterval(modifiedRule.getIntervalValue());
newRepeatRule.setIntervalValue(modifiedRule.getRepeatInterval());
newRepeatRule.setByDay(modifiedRule.getByDay());
newRepeatRule.setUntilDate(modifiedRule.getUntilDate());

Expand Down Expand Up @@ -468,7 +470,7 @@ private void updateRepeatRule(RepeatRule repeatRule, StudyPlanRequest.RepeatRule
private RepeatRuleEmbeddable createRepeatRuleEmbeddable(StudyPlanRequest.RepeatRuleRequest request, LocalDateTime startDate) {
RepeatRuleEmbeddable embeddable = new RepeatRuleEmbeddable();
embeddable.setFrequency(request.getFrequency());
embeddable.setIntervalValue(request.getIntervalValue());
embeddable.setRepeatInterval(request.getIntervalValue());

// byDay 자동 설정 (오버로딩된 메서드 사용)
getByDayInWeekly(request, startDate, embeddable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void t2() throws Exception {
.andExpect(jsonPath("$.data.startDate").value("2025-09-26T10:46:00"))
.andExpect(jsonPath("$.data.endDate").value("2025-09-26T11:46:00"))
.andExpect(jsonPath("$.data.repeatRule.frequency").value("DAILY"))
.andExpect(jsonPath("$.data.repeatRule.repeatInterval").value(1))
.andExpect(jsonPath("$.data.repeatRule.intervalValue").value(1))
.andExpect(jsonPath("$.data.repeatRule.byDay", hasSize(0)))
.andExpect(jsonPath("$.data.repeatRule.untilDate").value("2025-12-31"));

Expand Down
Loading