Open
Conversation
jjunhub
reviewed
Oct 26, 2024
Comment on lines
+49
to
+55
| /** | ||
| * 회원 탈퇴 시 회원 정보를 삭제한다. | ||
| */ | ||
| @DeleteMapping("/members/{memberId}/delete") | ||
| public void deleteMember(@PathVariable Long memberId) { | ||
| memberService.deleteMember(memberId); | ||
| } |
Member
There was a problem hiding this comment.
Delete Method 사용해주시는 부분 RESTful하게 좋습니다.
저도 종종 delete 관련 메소드 짤 때, 아래처럼 짜기도 하는데 아래처럼 짜면 api 형식이 깔끔해져서 좋더라구요. 참고해보시면 좋을 것 같습니다.
Suggested change
| /** | |
| * 회원 탈퇴 시 회원 정보를 삭제한다. | |
| */ | |
| @DeleteMapping("/members/{memberId}/delete") | |
| public void deleteMember(@PathVariable Long memberId) { | |
| memberService.deleteMember(memberId); | |
| } | |
| /** | |
| * 회원 탈퇴 시 회원 정보를 삭제한다. | |
| */ | |
| @DeleteMapping("/members/{memberId}") | |
| public void deleteMember(@PathVariable Long memberId) { | |
| memberService.deleteMember(memberId); | |
| } |
jjunhub
reviewed
Oct 26, 2024
Comment on lines
+61
to
63
| // 이건 좀 어렵네요...답지를 참고했습니다 자동생성으로 알려주긴 한데 없었으면 못 썼을 거 같습니다.... | ||
| return AuthLoginResponse.from(member); | ||
| } |
Member
There was a problem hiding this comment.
요 부분은 원래 안 익숙해서 그러실 수 있습니다!!
Effective Java 생성자 대신 Static Factory Method를 사용하자 한번 읽어보시는 거 추천!
jjunhub
reviewed
Oct 26, 2024
Comment on lines
+36
to
+39
| // 얘도 답지 없었으면 못 구현했음........... | ||
| return member.stream() | ||
| .map(MemberResponse::from) | ||
| .toList(); |
Member
There was a problem hiding this comment.
답지 보더라도 구현해내시느라 고생하셨씁니다 ㅎㅎ..
stream 부분은 나름 최신 문법이라 수업에서도 잘 안다루긴 합니다ㅜ
요 부분 기본으로 구현하는 방법은 문소현님 코드 참고하셔서 확ㅇ니해보시면 좋을 것 같습니다!
jjunhub
reviewed
Oct 26, 2024
Comment on lines
+55
to
+59
| // Member member = memberRepository.findById(memberId); | ||
| // if (member.isEmpty()) { | ||
| // throw new IllegalArgumentException("존재 안함 ㅠㅠ"); | ||
| // } | ||
| // 이렇게 쓰면 되는데 왜 위처럼 쓰면 안되지ㅣ.. |
Member
There was a problem hiding this comment.
JpaRepository에서 findById는 기본적으로 Optional이라는 형태로 나오게 됩니다. 이 클래스는 isEmpty() 등의 메소드를 가지고 있어서 주석처럼 사용될 수 있습니다. 하지만 Member 클래스는 기본 클래스로 isEmpty() 메소드를 갖고 있지 않습니다!
Java Optional 바르게 쓰기 글 읽어보시면 좋을 것 가탕요
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.
로그인 성공 화면
비밀번호 불일치로 로그인 실패 화면