Skip to content
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

[feat] 구매자 로그인 #64

Merged
merged 31 commits into from
Aug 15, 2024
Merged

Conversation

kimhyun5u
Copy link
Member

@kimhyun5u kimhyun5u commented Aug 15, 2024

💡 다음 이슈를 해결했어요.

Issue Link - #7

  • 구매자 로그인 기능 추가

💡 이슈를 처리하면서 추가된 코드가 있어요.

  • SignInCustomerService: 구매자 로그인을 진행함
  • CustomerApiController.login: 구매자 로그인 요청을 처리함

💡 이런 고민을 했어요.

  • 로그인 실패 시 서버에서는 정확한 원인을 알 수 있고 클라이언트는 알 수 없도록 하자

✅ 셀프 체크리스트

  • 내 코드를 스스로 검토했습니다.
  • 필요한 테스트를 추가했습니다.
  • 모든 테스트를 통과합니다.
  • 브랜치 전략에 맞는 브랜치에 PR을 올리고 있습니다.
  • 커밋 메세지를 컨벤션에 맞추었습니다.
  • wiki를 수정했습니다.

- CustomerFixture 의 기능과 목적을 설명하는 주석 명시
- 로그인 성공, 로그인 실패 - 이메일 없음, 패스워드 불일치 추가
- SignInCustomerService.signIn 구현
- 이메일 없음과 패스워드 불일치를 같이 처리하면서 보안 강화
- 구매자 로그인에 필요한 email, password 필드 추가
- 구매자 로그인 시 구매자 검색에 필요한 findByEmail 구현
- 구매자 로그인 실패 시 인증 오류 구현
- CustomerControllerTest.testSignInCustomer: 구매자 로그인 테스트 성공
- CustomerControllerTest.testSignInCustomerFail: 구매자 로그인 테스트 실패
- 구매자 로그인 성공 시 OK 반환
- 구매자 로그인 실패 시 BadRequest 반환
- 로그인 실패 시 ErrorCode 추가
- 구매자 로그인을 위한 SignInCustomerRequest 이메일, 패스워드 필드 추가
…매자_로그인

# Conflicts:
#	src/main/java/camp/woowak/lab/web/api/CustomerController.java
#	src/test/java/camp/woowak/lab/web/api/customer/CustomerApiControllerTest.java
- 구매자 로그인 실패 시 예외 추가
- 로그인 실패 시 에러코드 구현
- 이메일이 존재하지 않는 지 비밀번호가 존재하지 않는 지 서버 시점에서 명확히 구분할 수 있도록 수정
- UnauthorizedException(ErroCode, String) 생성자 추가
- 로그인 된 구매자의 UUID 를 전달하도록 수정
- CustomerApiControllerTest.testLoginCustomer: 로그인 성공 시 테스트
- CustomerApiControllerTest.testLoginFail: 로그인 실패 시 테스트
- 로그인 인증 후 session 에 LoginCustomer 저장
- 로그인 실패 시 발생하는 예외 처리
- CustomerApiController.login 반환값 추가
- 기존 400 로 관리하던 Status 를 HttpStatus 를 이용해 관리하도록 수정
- 비밀번호가 일치하지 않을 때 예외 던지도록 수정
@kimhyun5u kimhyun5u added the ✨ Feature 기능 개발 label Aug 15, 2024
@kimhyun5u kimhyun5u added this to the 프로토타입 만들기 milestone Aug 15, 2024
@kimhyun5u kimhyun5u requested a review from a team August 15, 2024 06:04
@kimhyun5u kimhyun5u self-assigned this Aug 15, 2024
Copy link
Member

@june-777 june-777 left a comment

Choose a reason for hiding this comment

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

간단한 메서드 분리만 한 번 고려해보시면 좋을 것 같습니다 👍

- ProblemDetail 를 생성하는 코드가 겹쳐서 private 메소드로 추출
@kimhyun5u kimhyun5u requested review from a team, Hyeon-Uk and Dr-KoKo and removed request for a team August 15, 2024 06:23
Copy link
Member

@Dr-KoKo Dr-KoKo left a comment

Choose a reason for hiding this comment

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

좋습니다. 저희 예외처리가 책임이 분산되어 있다는 느낌을 받고 있는데 추후 Discussion에서 논의하도록 하겠습니다.

@kimhyun5u kimhyun5u merged commit 8ca39de into main Aug 15, 2024
1 check passed
@kimhyun5u kimhyun5u deleted the feature/7_kimhyun5u_구매자_로그인 branch August 15, 2024 06:30
Copy link
Contributor

@Hyeon-Uk Hyeon-Uk left a comment

Choose a reason for hiding this comment

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

ExceptionHandler에서 메서드 추출해서 공통처리해준것 좋아보입니다!

@kimhyun5u
Copy link
Member Author

ExceptionHandler에서 메서드 추출해서 공통처리해준것 좋아보입니다!

리뷰 감사합니다 :3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants