Skip to content

Commit

Permalink
refactor: 빌더 사용 수정
Browse files Browse the repository at this point in the history
- MemberSurveys 빌더 사용 제거 및 생성자 이용하도록 수정 (빌더 어노테이션은 유지)
- MemberSurvey는 빌더 사용하도록 수정
  • Loading branch information
devholic22 committed Aug 12, 2024
1 parent be416f3 commit 2bb96f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ public class MemberSurvey {
@Column(nullable = false)
private Integer answerNumber;

private MemberSurvey(final Long surveyId, final Long questionId, final Integer answerNumber) {
this.surveyId = surveyId;
this.questionId = questionId;
this.answerNumber = answerNumber;
}

public static MemberSurvey of(final Long surveyId, final Long questionId, final Integer answerNumber) {
return new MemberSurvey(surveyId, questionId, answerNumber);
return MemberSurvey.builder()
.surveyId(surveyId)
.questionId(questionId)
.answerNumber(answerNumber)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ public class MemberSurveys {
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE}, orphanRemoval = true, fetch = FetchType.LAZY)
private List<MemberSurvey> memberSurveys = new ArrayList<>();

private MemberSurveys(final Long memberId, final List<MemberSurvey> memberSurveys) {
this.memberId = memberId;
this.memberSurveys = memberSurveys;
}

public static MemberSurveys createWithMemberId(final Long memberId) {
return MemberSurveys.builder()
.memberId(memberId)
.memberSurveys(new ArrayList<>())
.build();
return new MemberSurveys(memberId, new ArrayList<>());
}

public void submitSurveys(final List<SurveySubmitCreateDto> requests) {
Expand Down

0 comments on commit 2bb96f3

Please sign in to comment.