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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.back.global.security.user.CustomUserDetails;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
Expand All @@ -34,7 +35,7 @@ public class StudyPlanController {
public ResponseEntity<RsData<StudyPlanResponse>> createStudyPlan(
// 로그인 유저 정보 받기
@AuthenticationPrincipal CustomUserDetails user,
@RequestBody StudyPlanRequest request) {
@Valid @RequestBody StudyPlanRequest request) {
//커스텀 디테일 구현 시 사용
Long userId = user.getUserId();
StudyPlanResponse response = studyPlanService.createStudyPlan(userId, request);
Expand Down Expand Up @@ -93,7 +94,7 @@ public ResponseEntity<RsData<List<StudyPlanResponse>>> getStudyPlansForPeriod(
public ResponseEntity<RsData<StudyPlanResponse>> updateStudyPlan(
@AuthenticationPrincipal CustomUserDetails user,
@PathVariable Long planId,
@RequestBody StudyPlanRequest request,
@Valid @RequestBody StudyPlanRequest request,
@RequestParam(name = "applyScope", required = true) ApplyScope applyScope) {
Long userId = user.getUserId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.back.domain.study.plan.entity.DayOfWeek;
import com.back.domain.study.plan.entity.Frequency;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.Column;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -19,10 +23,13 @@
@Setter
@NoArgsConstructor
public class StudyPlanRequest {
@NotBlank
@Size(max = 100)
private String subject;

@NotNull
private LocalDateTime startDate;

@NotNull
private LocalDateTime endDate;

private Color color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class StudyPlanException extends BaseEntity {

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

// 수정된 내용 (MODIFIED 타입인 경우)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public List<StudyPlanResponse> getStudyPlansForDate(Long userId, LocalDate date)
}
}
}

return result;
}

Expand Down Expand Up @@ -167,6 +168,7 @@ private StudyPlanResponse createVirtualPlanForDate(StudyPlan originalPlan, Local
// 수정 타입의 경우 수정된 내용으로 가상 정보 생성 후 반환
return createModifiedVirtualPlan(originalPlan, exception, targetDate);
}

//예외 사항 없으면 기본 가상 계획 생성
return createBasicVirtualPlan(originalPlan, targetDate);
}
Expand Down
Loading