Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 스터디 개설시 제목필드 추가 #632

Merged
merged 4 commits into from
Aug 16, 2024
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 @@ -80,6 +80,7 @@ public class Study extends BaseSemesterEntity {
private Study(
Integer academicYear,
SemesterType semesterType,
String title,
Member mentor,
Period period,
Period applicationPeriod,
Expand All @@ -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;
Expand All @@ -102,6 +104,7 @@ private Study(
public static Study createStudy(
Integer academicYear,
SemesterType semesterType,
String title,
Member mentor,
Period period,
Period applicationPeriod,
Expand All @@ -116,6 +119,7 @@ public static Study createStudy(
return Study.builder()
.academicYear(academicYear)
.semesterType(semesterType)
.title(title)
.mentor(mentor)
.period(period)
.applicationPeriod(applicationPeriod)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -17,16 +18,15 @@ 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)
LocalDate applicationEndDate,
@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) {}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class 스터디_개설시 {
assertThatThrownBy(() -> Study.createStudy(
ACADEMIC_YEAR,
SEMESTER_TYPE,
STUDY_TITLE,
guestMember,
period,
applicationPeriod,
Expand All @@ -66,6 +67,7 @@ class 스터디_개설시 {
assertThatThrownBy(() -> Study.createStudy(
ACADEMIC_YEAR,
SEMESTER_TYPE,
STUDY_TITLE,
member,
period,
applicationPeriod,
Expand All @@ -89,6 +91,7 @@ class 스터디_개설시 {
assertThatThrownBy(() -> Study.createStudy(
ACADEMIC_YEAR,
SEMESTER_TYPE,
STUDY_TITLE,
member,
period,
applicationPeriod,
Expand All @@ -114,6 +117,7 @@ class 스터디_개설시 {
assertThatThrownBy(() -> Study.createStudy(
ACADEMIC_YEAR,
SEMESTER_TYPE,
STUDY_TITLE,
member,
period,
applicationPeriod,
Expand All @@ -139,6 +143,7 @@ class 스터디_개설시 {
assertThatThrownBy(() -> Study.createStudy(
ACADEMIC_YEAR,
SEMESTER_TYPE,
STUDY_TITLE,
member,
period,
applicationPeriod,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down