Skip to content

고희준 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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

고희준 2주차 과제 #2

wants to merge 1 commit into from

Conversation

AJKHJ
Copy link

@AJKHJ AJKHJ commented Oct 8, 2024

스크린샷 2024-10-08 오후 10 53 29 삭제할 때 id와 이름이 같지 않으면 다음과 같은 오류메시지를 출력하게 하였습니다.

Comment on lines 57 to 64
// 만약 일치하는 회원이 없다면, IllegalArgumentException을 발생시킨다.

if(member == null) {
throw new IllegalArgumentException("존재하지 않는 회원입니다. 다시 시도해주세요.");
}
// 일치하는 회원이 있다면, MemberResponse로 변환하여 반환한다.
return null;
else
return AuthLoginResponse.from(member);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔하게 잘 작성해주셨습니다!
한 가지 확장성 측면에서 고려해보자면, 다음과 같이 작성해보아도 좋을 것 같아요

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

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);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 작성해주셨습니다! 굿굿입니다

Copy link
Member

@jjunhub jjunhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨씁니다! 전반적으로 잘 해주셨네요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants