Skip to content

Commit 810f427

Browse files
authored
Merge branch 'dev' into refactor/257
2 parents c690605 + 6fc8568 commit 810f427

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/main/java/com/back/domain/study/plan/controller/StudyPlanController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.back.global.security.user.CustomUserDetails;
1111
import io.swagger.v3.oas.annotations.Operation;
1212
import io.swagger.v3.oas.annotations.tags.Tag;
13+
import jakarta.validation.Valid;
1314
import lombok.RequiredArgsConstructor;
1415
import org.springframework.format.annotation.DateTimeFormat;
1516
import org.springframework.http.ResponseEntity;
@@ -34,7 +35,7 @@ public class StudyPlanController {
3435
public ResponseEntity<RsData<StudyPlanResponse>> createStudyPlan(
3536
// 로그인 유저 정보 받기
3637
@AuthenticationPrincipal CustomUserDetails user,
37-
@RequestBody StudyPlanRequest request) {
38+
@Valid @RequestBody StudyPlanRequest request) {
3839
//커스텀 디테일 구현 시 사용
3940
Long userId = user.getUserId();
4041
StudyPlanResponse response = studyPlanService.createStudyPlan(userId, request);
@@ -93,7 +94,7 @@ public ResponseEntity<RsData<List<StudyPlanResponse>>> getStudyPlansForPeriod(
9394
public ResponseEntity<RsData<StudyPlanResponse>> updateStudyPlan(
9495
@AuthenticationPrincipal CustomUserDetails user,
9596
@PathVariable Long planId,
96-
@RequestBody StudyPlanRequest request,
97+
@Valid @RequestBody StudyPlanRequest request,
9798
@RequestParam(name = "applyScope", required = true) ApplyScope applyScope) {
9899
Long userId = user.getUserId();
99100

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import com.back.domain.study.plan.entity.DayOfWeek;
55
import com.back.domain.study.plan.entity.Frequency;
66
import com.fasterxml.jackson.annotation.JsonFormat;
7+
import jakarta.persistence.Column;
8+
import jakarta.validation.constraints.NotBlank;
9+
import jakarta.validation.constraints.NotNull;
10+
import jakarta.validation.constraints.Size;
711
import lombok.AllArgsConstructor;
812
import lombok.Getter;
913
import lombok.NoArgsConstructor;
@@ -19,10 +23,13 @@
1923
@Setter
2024
@NoArgsConstructor
2125
public class StudyPlanRequest {
26+
@NotBlank
27+
@Size(max = 100)
2228
private String subject;
2329

30+
@NotNull
2431
private LocalDateTime startDate;
25-
32+
@NotNull
2633
private LocalDateTime endDate;
2734

2835
private Color color;

src/main/java/com/back/domain/study/plan/entity/StudyPlanException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class StudyPlanException extends BaseEntity {
3535

3636
// 적용 범위 (이 날짜만 / 이후 모든 날짜)
3737
@Enumerated(EnumType.STRING)
38-
@Column(name = "apply_scope")
38+
@Column(name = "apply_scope", nullable = false)
3939
private ApplyScope applyScope;
4040

4141
// 수정된 내용 (MODIFIED 타입인 경우)

src/main/java/com/back/domain/study/plan/service/StudyPlanService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public List<StudyPlanResponse> getStudyPlansForDate(Long userId, LocalDate date)
103103
}
104104
}
105105
}
106+
106107
return result;
107108
}
108109

@@ -167,6 +168,7 @@ private StudyPlanResponse createVirtualPlanForDate(StudyPlan originalPlan, Local
167168
// 수정 타입의 경우 수정된 내용으로 가상 정보 생성 후 반환
168169
return createModifiedVirtualPlan(originalPlan, exception, targetDate);
169170
}
171+
170172
//예외 사항 없으면 기본 가상 계획 생성
171173
return createBasicVirtualPlan(originalPlan, targetDate);
172174
}

0 commit comments

Comments
 (0)