diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java index 0d6639b31..8ea68eeb8 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java @@ -80,6 +80,7 @@ public class Study extends BaseSemesterEntity { private Study( Integer academicYear, SemesterType semesterType, + String title, Member mentor, Period period, Period applicationPeriod, @@ -89,6 +90,7 @@ private Study( LocalTime startTime, LocalTime endTime) { super(academicYear, semesterType); + this.title = title; this.mentor = mentor; this.period = period; this.applicationPeriod = applicationPeriod; @@ -102,6 +104,7 @@ private Study( public static Study createStudy( Integer academicYear, SemesterType semesterType, + String title, Member mentor, Period period, Period applicationPeriod, @@ -116,6 +119,7 @@ public static Study createStudy( return Study.builder() .academicYear(academicYear) .semesterType(semesterType) + .title(title) .mentor(mentor) .period(period) .applicationPeriod(applicationPeriod) diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudyCreateRequest.java b/src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudyCreateRequest.java index cb5153e3c..a6e859f48 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudyCreateRequest.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/dto/request/StudyCreateRequest.java @@ -6,6 +6,7 @@ import com.gdschongik.gdsc.domain.study.domain.StudyType; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Future; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import java.time.DayOfWeek; @@ -17,6 +18,7 @@ public record StudyCreateRequest( @NotNull(message = "학년도는 null이 될 수 없습니다.") @Schema(description = "학년도", pattern = ACADEMIC_YEAR) Integer academicYear, @NotNull(message = "학기는 null이 될 수 없습니다.") @Schema(description = "학기") SemesterType semesterType, + @NotBlank(message = "스터디 제목을 입력해 주세요.") @Schema(description = "제목") String title, @NotNull(message = "신청기간 시작일은 null이 될 수 없습니다.") @Schema(description = "신청기간 시작일", pattern = DATE) LocalDate applicationStartDate, @Future @NotNull(message = "신청기간 종료일은 null이 될 수 없습니다.") @Schema(description = "신청기간 종료일", pattern = DATE) @@ -24,9 +26,7 @@ public record StudyCreateRequest( @Positive @NotNull(message = "총 주차수는 null이 될 수 없습니다.") @Schema(description = "총 주차수") Long totalWeek, @Future @NotNull(message = "스터디 시작일은 null이 될 수 없습니다.") @Schema(description = "스터디 시작일", pattern = DATE) LocalDate startDate, - @NotNull(message = "스터디 요일은 null이 될 수 없습니다.") @Schema(description = "스터디 요일", implementation = DayOfWeek.class) - DayOfWeek dayOfWeek, - @NotNull @Schema(description = "스터디 시작 시간", implementation = LocalTime.class) LocalTime studyStartTime, - @NotNull @Schema(description = "스터디 종료 시간", implementation = LocalTime.class) LocalTime studyEndTime, - @NotNull(message = "스터디 타입은 null이 될 수 없습니다.") @Schema(description = "스터디 타입", implementation = StudyType.class) - StudyType studyType) {} + @NotNull(message = "스터디 요일은 null이 될 수 없습니다.") @Schema(description = "스터디 요일") DayOfWeek dayOfWeek, + @NotNull @Schema(description = "스터디 시작 시간") LocalTime studyStartTime, + @NotNull @Schema(description = "스터디 종료 시간") LocalTime studyEndTime, + @NotNull(message = "스터디 타입은 null이 될 수 없습니다.") @Schema(description = "스터디 타입") StudyType studyType) {} diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java b/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java index 3c45acb51..a8a610410 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java @@ -20,6 +20,7 @@ public Study createNewStudy(StudyCreateRequest request, Member mentor) { return Study.createStudy( request.academicYear(), request.semesterType(), + request.title(), mentor, Period.createPeriod(request.startDate().atStartOfDay(), endDate.atTime(LocalTime.MAX)), Period.createPeriod( diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java index 131a58783..bd254bbaa 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java @@ -43,6 +43,7 @@ class 스터디_개설시 { assertThatThrownBy(() -> Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, guestMember, period, applicationPeriod, @@ -66,6 +67,7 @@ class 스터디_개설시 { assertThatThrownBy(() -> Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, member, period, applicationPeriod, @@ -89,6 +91,7 @@ class 스터디_개설시 { assertThatThrownBy(() -> Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, member, period, applicationPeriod, @@ -114,6 +117,7 @@ class 스터디_개설시 { assertThatThrownBy(() -> Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, member, period, applicationPeriod, @@ -139,6 +143,7 @@ class 스터디_개설시 { assertThatThrownBy(() -> Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, member, period, applicationPeriod, diff --git a/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java b/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java index b9839811b..71c19f31f 100644 --- a/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java +++ b/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java @@ -7,6 +7,7 @@ public class StudyConstant { private StudyConstant() {} + public static final String STUDY_TITLE = "스터디 제목"; public static final Long TOTAL_WEEK = 8L; public static final StudyType ONLINE_STUDY = StudyType.ONLINE; public static final StudyType ASSIGNMENT_STUDY = StudyType.ASSIGNMENT; diff --git a/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java b/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java index f6a4c1cdf..a3b308835 100644 --- a/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java +++ b/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java @@ -71,6 +71,7 @@ public Study createStudy(Member mentor, Period period, Period applicationPeriod) return Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, mentor, period, applicationPeriod, diff --git a/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java b/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java index 3401a349a..92f63c521 100644 --- a/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java +++ b/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java @@ -210,6 +210,7 @@ protected Study createStudy(Member mentor, Period period, Period applicationPeri Study study = Study.createStudy( ACADEMIC_YEAR, SEMESTER_TYPE, + STUDY_TITLE, mentor, period, applicationPeriod,