-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/#99 #103
Feature/#99 #103
Changes from 3 commits
b02b9bc
de83c95
31ecb1c
7ca22c4
528ad6d
c945b61
74e09a6
a4d5e2d
b2f9e42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package b1nd.dodam.restapi.member.application.data.req; | ||
|
||
public record UpdateStudentForAdminReq(String pw, String name, String phone, String parentPhone, Integer grade, | ||
Integer room, Integer number, String tel, String position) {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,16 @@ | |
import b1nd.dodam.domain.rds.member.enumeration.MemberRole; | ||
import b1nd.dodam.domain.rds.support.entity.BaseEntity; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import jakarta.persistence.*; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Id; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Objects; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
@Getter | ||
@Entity(name = "member") | ||
|
@@ -44,8 +46,10 @@ public class Member extends BaseEntity { | |
@NotNull | ||
private String phone; | ||
|
||
private String parentPhone; | ||
suw0n marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 부모님 번호는 공통 정보가 아니라 학생의 정보이므로 굳이 member 에 추가하기 보다는 student에 추가하는게 맞는 것 같습니다 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @NotNull 도 추가해주세요 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 |
||
|
||
@Builder | ||
public Member(String id, String pw, String name, String email, MemberRole role, ActiveStatus status, String profileImage, String phone) { | ||
public Member(String id, String pw, String name, String email, MemberRole role, ActiveStatus status, String profileImage, String phone, String parentPhone) { | ||
this.id = id; | ||
this.pw = pw; | ||
this.email = email; | ||
|
@@ -54,27 +58,43 @@ public Member(String id, String pw, String name, String email, MemberRole role, | |
this.status = status; | ||
this.profileImage = profileImage; | ||
this.phone = phone; | ||
this.parentPhone = parentPhone; | ||
} | ||
|
||
public void updatePw(String pw) { | ||
this.pw = pw; | ||
} | ||
|
||
public void updateInfo(String name, String email, String phone, String profileImage) { | ||
if(Objects.nonNull(name)) { | ||
if(StringUtils.isNotBlank(name)){ | ||
this.name = name; | ||
} | ||
if(Objects.nonNull(email)) { | ||
if(StringUtils.isNotBlank(email)){ | ||
this.email = email; | ||
} | ||
if(Objects.nonNull(phone)) { | ||
if(StringUtils.isNotBlank(phone)){ | ||
this.phone = phone; | ||
} | ||
if(Objects.nonNull(profileImage)) { | ||
if(StringUtils.isNotBlank(profileImage)){ | ||
this.profileImage = profileImage; | ||
} | ||
} | ||
|
||
public void updateInfoForAdmin(String pw, String name, String phone, String parentPhone){ | ||
if(StringUtils.isNotBlank(pw)){ | ||
this.phone = pw; | ||
} | ||
if(StringUtils.isNotBlank(name)){ | ||
this.name = name; | ||
} | ||
if(StringUtils.isNotBlank(phone)){ | ||
this.phone = phone; | ||
} | ||
if(StringUtils.isNotBlank(parentPhone)){ | ||
this.parentPhone = parentPhone; | ||
} | ||
} | ||
|
||
public void updateStatus(ActiveStatus status) { | ||
this.status = status; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package b1nd.dodam.domain.rds.member.exception; | ||
|
||
import b1nd.dodam.core.exception.CustomException; | ||
|
||
public class UnmodifiableRole extends CustomException { | ||
|
||
public UnmodifiableRole() { | ||
super(MemberExceptionCode.UNMODIFIABLE_ROLE); | ||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
공통 부분을 switch case 문에 넣을 필요가 없어 보입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네