11package dmu .dasom .api .domain .applicant .entity ;
22
3+ import dmu .dasom .api .domain .applicant .dto .ApplicantCreateRequestDto ;
34import dmu .dasom .api .domain .applicant .dto .ApplicantDetailsResponseDto ;
45import dmu .dasom .api .domain .applicant .dto .ApplicantResponseDto ;
56import dmu .dasom .api .domain .applicant .enums .ApplicantStatus ;
910import lombok .Builder ;
1011import lombok .Getter ;
1112import lombok .NoArgsConstructor ;
13+ import org .hibernate .annotations .DynamicUpdate ;
1214import org .springframework .data .annotation .CreatedDate ;
1315import org .springframework .data .annotation .LastModifiedDate ;
1416import org .springframework .data .jpa .domain .support .AuditingEntityListener ;
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