Open
Conversation
AJKHJ
commented
Oct 8, 2024
삭제할 때 id와 이름이 같지 않으면 다음과 같은 오류메시지를 출력하게 하였습니다.
jjunhub
reviewed
Oct 26, 2024
Comment on lines
57
to
64
| // 만약 일치하는 회원이 없다면, IllegalArgumentException을 발생시킨다. | ||
|
|
||
| if(member == null) { | ||
| throw new IllegalArgumentException("존재하지 않는 회원입니다. 다시 시도해주세요."); | ||
| } | ||
| // 일치하는 회원이 있다면, MemberResponse로 변환하여 반환한다. | ||
| return null; | ||
| else | ||
| return AuthLoginResponse.from(member); | ||
| } |
Member
There was a problem hiding this comment.
깔끔하게 잘 작성해주셨습니다!
한 가지 확장성 측면에서 고려해보자면, 다음과 같이 작성해보아도 좋을 것 같아요
Suggested change
| // 만약 일치하는 회원이 없다면, 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
jjunhub
reviewed
Oct 26, 2024
Comment on lines
+63
to
69
| public void deleteMember(String memberLoginId, String memberName) { | ||
| Member member = memberRepository.findByMemberLoginIdAndMemberName(memberLoginId, memberName); | ||
| if (member == null) { | ||
| throw new IllegalArgumentException("존재하지 않는 회원입니다. 올바른 Id와 이름을 입력하세요."); | ||
| } | ||
| memberRepository.delete(member); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.