-
Notifications
You must be signed in to change notification settings - Fork 11
고희준 2주차 과제 #2
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
base: main
Are you sure you want to change the base?
고희준 2주차 과제 #2
Conversation
AJKHJ
commented
Oct 8, 2024

// 만약 일치하는 회원이 없다면, IllegalArgumentException을 발생시킨다. | ||
|
||
if(member == null) { | ||
throw new IllegalArgumentException("존재하지 않는 회원입니다. 다시 시도해주세요."); | ||
} | ||
// 일치하는 회원이 있다면, MemberResponse로 변환하여 반환한다. | ||
return null; | ||
else | ||
return AuthLoginResponse.from(member); | ||
} |
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.
깔끔하게 잘 작성해주셨습니다!
한 가지 확장성 측면에서 고려해보자면, 다음과 같이 작성해보아도 좋을 것 같아요
// 만약 일치하는 회원이 없다면, IllegalArgumentException을 발생시킨다. | |
if(member == null) { | |
throw new IllegalArgumentException("존재하지 않는 회원입니다. 다시 시도해주세요."); | |
} | |
// 일치하는 회원이 있다면, MemberResponse로 변환하여 반환한다. | |
return null; | |
else | |
return AuthLoginResponse.from(member); | |
} | |
// 만약 일치하는 회원이 없다면, IllegalArgumentException을 발생시킨다. | |
if(member == null) { | |
throw new IllegalArgumentException("존재하지 않는 회원입니다. 다시 시도해주세요."); | |
} | |
// ( 가정 ) 만약 회원이 차단된 회원이라면, IllegalArgumentException을 발생시킨다. | |
if(member.isBanned()) { | |
throw new IllegalArgumentException("차단된 회원입니다. 고객 문의로 연락주세요"); | |
} | |
// 일치하는 회원이 있다면, MemberResponse로 변환하여 반환한다. | |
return AuthLoginResponse.from(member); | |
} |
해당 내용을 다루는 좋은 글 공유드리곘습니다.
https://limdingdong.tistory.com/8
public void deleteMember(String memberLoginId, String memberName) { | ||
Member member = memberRepository.findByMemberLoginIdAndMemberName(memberLoginId, memberName); | ||
if (member == null) { | ||
throw new IllegalArgumentException("존재하지 않는 회원입니다. 올바른 Id와 이름을 입력하세요."); | ||
} | ||
memberRepository.delete(member); | ||
} |
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.
잘 작성해주셨습니다! 굿굿입니다
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.
고생하셨씁니다! 전반적으로 잘 해주셨네요