Skip to content

강수빈 2주차 과제 #4

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 4 commits into
base: main
Choose a base branch
from
Open

Conversation

gae-ddong
Copy link

로그인 성공 화면

스크린샷 2024-10-09 오후 12 19 22

비밀번호 불일치로 로그인 실패 화면

스크린샷 2024-10-09 오후 12 19 37 ### 로그인 실패 시 예외처리 메세지 출력 화면 스크린샷 2024-10-09 오후 12 19 51

Comment on lines +49 to +55
/**
* 회원 탈퇴 시 회원 정보를 삭제한다.
*/
@DeleteMapping("/members/{memberId}/delete")
public void deleteMember(@PathVariable Long memberId) {
memberService.deleteMember(memberId);
}
Copy link
Member

Choose a reason for hiding this comment

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

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);
}

Comment on lines +61 to 63
// 이건 좀 어렵네요...답지를 참고했습니다 자동생성으로 알려주긴 한데 없었으면 못 썼을 거 같습니다....
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.

요 부분은 원래 안 익숙해서 그러실 수 있습니다!!
Effective Java 생성자 대신 Static Factory Method를 사용하자 한번 읽어보시는 거 추천!

Comment on lines +36 to +39
// 얘도 답지 없었으면 못 구현했음...........
return member.stream()
.map(MemberResponse::from)
.toList();
Copy link
Member

Choose a reason for hiding this comment

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

답지 보더라도 구현해내시느라 고생하셨씁니다 ㅎㅎ..
stream 부분은 나름 최신 문법이라 수업에서도 잘 안다루긴 합니다ㅜ
요 부분 기본으로 구현하는 방법은 문소현님 코드 참고하셔서 확ㅇ니해보시면 좋을 것 같습니다!

Comment on lines +55 to +59
// Member member = memberRepository.findById(memberId);
// if (member.isEmpty()) {
// throw new IllegalArgumentException("존재 안함 ㅠㅠ");
// }
// 이렇게 쓰면 되는데 왜 위처럼 쓰면 안되지ㅣ..
Copy link
Member

Choose a reason for hiding this comment

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

JpaRepository에서 findById는 기본적으로 Optional이라는 형태로 나오게 됩니다. 이 클래스는 isEmpty() 등의 메소드를 가지고 있어서 주석처럼 사용될 수 있습니다. 하지만 Member 클래스는 기본 클래스로 isEmpty() 메소드를 갖고 있지 않습니다!
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