Skip to content

Conversation

@sohyun022
Copy link
Member

@sohyun022 sohyun022 commented Oct 8, 2024

스크린샷 2024-10-09 오전 2 43 52 스크린샷 2024-10-09 오전 2 45 56 스크린샷 2024-10-09 오전 2 47 04

@sohyun022 sohyun022 changed the title 2주차 과제 문소현 2주차 과제 Oct 8, 2024
Comment on lines +59 to 61
// 일치하는 회원이 있다면, AuthLoginResponse로 변환하여 반환한다.
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.

주석 틀리게 작성됐던 것 지금 확인했네요.. 좋습니다!!@@!

Comment on lines +66 to +72
Optional<Member> OptionalMember = memberRepository.findById(memberId);

if(OptionalMember.isEmpty()) {
throw new IllegalArgumentException();
}

Member member = OptionalMember.get();
Copy link
Member

@jjunhub jjunhub Oct 26, 2024

Choose a reason for hiding this comment

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

꼼꼼하게 잘 처리해주셨습니다!
Optional을 직접적으로 사용하는 것보다는 아래처럼 사용하는 것이 권장되는 편입니다.

Suggested change
Optional<Member> OptionalMember = memberRepository.findById(memberId);
if(OptionalMember.isEmpty()) {
throw new IllegalArgumentException();
}
Member member = OptionalMember.get();
Member member = memberRepository.findById(memberId)
.orElseThrow(() -> new IllegalArgumentException("에러 발생"));

Java Optional 바르게 사용하기 블로그 글 한 번 정독해보시는 것을 추천드릴게요!!

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.

2 participants