diff --git a/src/main/java/com/back/domain/study/plan/dto/StudyPlanDeleteRequest.java b/src/main/java/com/back/domain/study/plan/dto/StudyPlanDeleteRequest.java deleted file mode 100644 index 6b9b8624..00000000 --- a/src/main/java/com/back/domain/study/plan/dto/StudyPlanDeleteRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.back.domain.study.plan.dto; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class StudyPlanDeleteRequest { - private DeleteScope deleteScope; - - public enum DeleteScope { - THIS_ONLY, // 이 날짜만 - FROM_THIS_DATE // 이 날짜부터 이후 모든 날짜 - } -} \ No newline at end of file diff --git a/src/main/java/com/back/domain/study/plan/dto/StudyPlanResponse.java b/src/main/java/com/back/domain/study/plan/dto/StudyPlanResponse.java index cd865401..b97535b7 100644 --- a/src/main/java/com/back/domain/study/plan/dto/StudyPlanResponse.java +++ b/src/main/java/com/back/domain/study/plan/dto/StudyPlanResponse.java @@ -42,25 +42,26 @@ public class StudyPlanResponse { @AllArgsConstructor public static class RepeatRuleResponse { private Frequency frequency; - private Integer repeatInterval; + private Integer intervalValue; private List 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(); diff --git a/src/main/java/com/back/domain/study/plan/entity/RepeatRuleEmbeddable.java b/src/main/java/com/back/domain/study/plan/entity/RepeatRuleEmbeddable.java index ac12aef9..e196dd51 100644 --- a/src/main/java/com/back/domain/study/plan/entity/RepeatRuleEmbeddable.java +++ b/src/main/java/com/back/domain/study/plan/entity/RepeatRuleEmbeddable.java @@ -21,7 +21,7 @@ public class RepeatRuleEmbeddable { @Enumerated(EnumType.STRING) private Frequency frequency; - private Integer intervalValue; + private Integer repeatInterval; private List byDay = new ArrayList<>(); private LocalDate untilDate; // LocalDateTime → LocalDate 변경 } \ No newline at end of file diff --git a/src/main/java/com/back/domain/study/plan/entity/StudyPlanException.java b/src/main/java/com/back/domain/study/plan/entity/StudyPlanException.java index e274ee1a..d9fcc762 100644 --- a/src/main/java/com/back/domain/study/plan/entity/StudyPlanException.java +++ b/src/main/java/com/back/domain/study/plan/entity/StudyPlanException.java @@ -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")) }) diff --git a/src/main/java/com/back/domain/study/plan/service/StudyPlanService.java b/src/main/java/com/back/domain/study/plan/service/StudyPlanService.java index 66b09017..10efea91 100644 --- a/src/main/java/com/back/domain/study/plan/service/StudyPlanService.java +++ b/src/main/java/com/back/domain/study/plan/service/StudyPlanService.java @@ -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; } @@ -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()); @@ -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); diff --git a/src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java b/src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java index 116a3a87..e0b577c1 100644 --- a/src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java +++ b/src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java @@ -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"));