Skip to content

Commit 04a3288

Browse files
committed
refactor: 빌더 패턴 제거
1 parent deb9ff2 commit 04a3288

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/main/java/com/example/solidconnection/mentor/domain/Mentoring.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import jakarta.persistence.PrePersist;
1313
import lombok.AccessLevel;
1414
import lombok.AllArgsConstructor;
15-
import lombok.Builder;
1615
import lombok.Getter;
1716
import lombok.NoArgsConstructor;
1817
import org.hibernate.annotations.DynamicInsert;
@@ -25,7 +24,6 @@
2524

2625
@Entity
2726
@Getter
28-
@Builder
2927
@EntityListeners(AuditingEntityListener.class)
3028
@DynamicInsert
3129
@AllArgsConstructor
@@ -58,6 +56,12 @@ public class Mentoring {
5856
@Column
5957
private long menteeId;
6058

59+
public Mentoring(long mentorId, long menteeId, VerifyStatus verifyStatus) {
60+
this.mentorId = mentorId;
61+
this.menteeId = menteeId;
62+
this.verifyStatus = verifyStatus;
63+
}
64+
6165
@PrePersist
6266
public void onPrePersist() {
6367
this.createdAt = ZonedDateTime.now(UTC).truncatedTo(MICROS); // 나노초 6자리 까지만 저장

src/main/java/com/example/solidconnection/mentor/service/MentoringCommandService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public class MentoringCommandService {
3030

3131
@Transactional
3232
public MentoringApplyResponse applyMentoring(long siteUserId, MentoringApplyRequest mentoringApplyRequest) {
33-
Mentoring mentoring = Mentoring.builder()
34-
.mentorId(mentoringApplyRequest.mentorId())
35-
.menteeId(siteUserId)
36-
.verifyStatus(VerifyStatus.PENDING)
37-
.build();
33+
Mentoring mentoring = new Mentoring(
34+
mentoringApplyRequest.mentorId(),
35+
siteUserId,
36+
VerifyStatus.PENDING
37+
);
3838

3939
return MentoringApplyResponse.from(mentoringRepository.save(mentoring));
4040
}

0 commit comments

Comments
 (0)