Skip to content

Commit 6c2e47a

Browse files
committed
feat: 지원자 정보 갱신 (덮어쓰기) 메소드 구현, studentNo Unique 제약조건 추가
1 parent 0a8bf83 commit 6c2e47a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main/java/dmu/dasom/api/domain/applicant/entity/Applicant.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dmu.dasom.api.domain.applicant.entity;
22

3+
import dmu.dasom.api.domain.applicant.dto.ApplicantCreateRequestDto;
34
import dmu.dasom.api.domain.applicant.dto.ApplicantDetailsResponseDto;
45
import dmu.dasom.api.domain.applicant.dto.ApplicantResponseDto;
56
import dmu.dasom.api.domain.applicant.enums.ApplicantStatus;
@@ -9,6 +10,7 @@
910
import lombok.Builder;
1011
import lombok.Getter;
1112
import lombok.NoArgsConstructor;
13+
import org.hibernate.annotations.DynamicUpdate;
1214
import org.springframework.data.annotation.CreatedDate;
1315
import org.springframework.data.annotation.LastModifiedDate;
1416
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -17,6 +19,7 @@
1719

1820
@AllArgsConstructor
1921
@Builder
22+
@DynamicUpdate
2023
@Entity
2124
@EntityListeners(AuditingEntityListener.class)
2225
@Getter
@@ -32,7 +35,7 @@ public class Applicant {
3235
@Size(max = 16)
3336
private String name;
3437

35-
@Column(name = "student_no", nullable = false, length = 8)
38+
@Column(name = "student_no", nullable = false, unique = true, length = 8)
3639
@Pattern(regexp = "^[0-9]{8}$")
3740
@Size(min = 8, max = 8)
3841
private String studentNo;
@@ -105,4 +108,14 @@ public ApplicantDetailsResponseDto toApplicantDetailsResponse() {
105108
.build();
106109
}
107110

111+
public void overwrite(final ApplicantCreateRequestDto request) {
112+
this.name = request.getName();
113+
this.contact = request.getContact();
114+
this.email = request.getEmail();
115+
this.grade = request.getGrade();
116+
this.reasonForApply = request.getReasonForApply();
117+
this.activityWish = request.getActivityWish();
118+
this.isPrivacyPolicyAgreed = request.getIsPrivacyPolicyAgreed();
119+
}
120+
108121
}

0 commit comments

Comments
 (0)