-
Notifications
You must be signed in to change notification settings - Fork 1
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
로그인 로직 개발 #53
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 이슈 처리하시느라 고생하셨습니다! 👍🏼
몇 가지가지 궁금한 사항들작성해 두었고었수정해야 하는하는 목록에 대해서도 코멘트를 달아두었습니다!
하시다가 궁금하신 내용이 있다질문해 주시면시면 감사합니다!
application/wypl-core/src/main/java/com/wypl/wyplcore/auth/controller/AuthController.java
Outdated
Show resolved
Hide resolved
application/wypl-core/src/main/java/com/wypl/wyplcore/auth/service/AuthServiceImpl.java
Outdated
Show resolved
Hide resolved
application/wypl-core/src/test/java/com/wypl/wyplcore/auth/controller/AuthControllerTest.java
Show resolved
Hide resolved
domain/redis-token-domain/src/test/java/com/wypl/redistokendomain/TokenRepositoryTest.java
Outdated
Show resolved
Hide resolved
assertThat(result.getId()).isEqualTo(findSocialMember.getId()); | ||
assertThat(result.getMember().getMemberId()).isEqualTo(findSocialMember.getMember().getMemberId()); | ||
assertThat(result.getOauthId()).isEqualTo(findSocialMember.getOauthId()); | ||
assertThat(result.getOauthProvider()).isEqualTo(findSocialMember.getOauthProvider()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 하나씩 하는 것 보다 재귀적으로 확인할 수 있는 테스트 방법이 있습니다!
해당 방법으로 수정해보시고, 발생하는 문제점을 해결해보시면 좋을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인해보니 isEqualTo()
메서드는 Object끼리 비교가 가능하여 assertThat(result).isEqualTo(findSocialMember)
으로 수정했습니다!
의도하신 방법이 맞을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다른 방법을 의도하였는데! 해당 방법으로 성공이 되었군요! 아마도 BaseEntity
를 extends
하지 않아서 그런 것 같습니다!
assertThat(foundMember)
.usingRecursiveComparison()
.ignoringFields("created", "lastModified")
.isEqualTo(savedMember);
다음과 같이 객체 내부의 필드 값들에 대해서 재귀적으로 검증하면서 일부 검증이 불필요한 내용을 제외하는 방법이 있습니다! 추후 다른 테스트를 진행하실 때 사용해 보면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 방법도 있었군요! 배워갑니다. 감사합니다 😄
public static SocialMember getSocialMember(SocialMemberRepository socialMemberRepository, String id) { | ||
return socialMemberRepository.findByOauthProviderAndOauthId(OauthProvider.GOOGLE, id) | ||
.orElseThrow(() -> new MemberException(MemberErrorCode.NO_SUCH_MEMBER)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 내용을 보아하니 구글에 종속이 되어 보입니다!
만약 다른 로그인 방식이 생긴다면 어떻게 처리하실건가요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 지적 감사합니다!
현재 생각으로는 OauthProvider
를 파라미터로 전달받도록 할 것 같습니다.
메서드를 사용하는 모든 곳에서 수정해야 한다는 번거로움이 있지만, 아직 다른 방법이 떠오르지 않습니다 😢
혹시 고려해볼 방법이 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실 파라미터를 제외하면 생각할 방법이 메서드의 이름에다 어떤 제공자에게 인증을 받았는지 적어주는 방법이 생각납니다!
public static SocialMember getSocialMemberByGoogle(SocialMemberRepository socialMemberRepository, String id) {
return socialMemberRepository.findByOauthProviderAndOauthId(OauthProvider.GOOGLE, id)
.orElseThrow(() -> new MemberException(MemberErrorCode.NO_SUCH_MEMBER));
}
하지만 새로운 제공자가 생기면 메서드가 하나씩 늘어난다는 단점이 있습니다! 한번 고민해 보시고 선택하면 좋을 것 같아요!
domain/jpa-member-domain/src/main/java/com/wypl/jpamemberdomain/member/data/MemberDto.java
Outdated
Show resolved
Hide resolved
...in/jpa-member-domain/src/main/java/com/wypl/jpamemberdomain/member/data/SocialMemberDto.java
Outdated
Show resolved
Hide resolved
// Todo : Access Level 고민해보자 | ||
// @AllArgsConstructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석 내용을 해결해주시면 감사합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AllArgsConstructor
가 인식되지 않는 원인을 아직 해결하지 못해서 해당 부분 주석 처리 후 생성자를 명시적으로 추가해놓은 상태입니다.
해결하는 대로 더 고민해보겠습니다!
domain/auth-domain/src/main/java/com/wypl/authdomain/auth/service/AuthDomainServiceImpl.java
Outdated
Show resolved
Hide resolved
clean test -> test -i로 변경
isEqualTo(false) -> isFalse()
📄 Jacoco Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적으로 잘 된 것 같습니다!!
해당 이슈 개발하느라 엄청 고생많으셨습니다! 👍🏼
먼저 Approve
를 해두었습니다! 몇몇 희망사항을 적어봤는데 한번 봐주시면 좋을 것 같습니다!
|
||
@Transactional | ||
public void quitMember(AuthMember authMember) { | ||
// Todo : 회원 탈퇴 로직 논의 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 논의가 필요하다는 내용으로 이슈를 하나 만들어주세요! 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정리해서 올려보겠습니다!
@AutoConfigureRestDocs | ||
// @AutoConfigureMockMvc | ||
// @SpringBootTest | ||
@WebMvcTest(AuthController.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! 따로 작성하신 문서를 봤는데 잘 해결하신 것 같아요!
그렇다면 @ControllerTest
와 같은 어노테이션을 만들어서 처리할 수 있을 것 같은데 따로 이슈를 만들어서 해결해보는건 어떨까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 의견입니다!
두 어노테이션을 합해서 만들어보겠습니다.
Dto의 의도가 명확하지 않다는 피드백을 반영하여 아래와 같이 변경했습니다. - MemberDto -> MemberSaveDto - SocialMemberDto -> SocialMemberSaveDto
실행 속도는 느려지지만 최신 상태에서 테스트 하는 것이 더 중요하다고 생각하여 clean 명령어 추가
📄 Jacoco Coverage Report
|
📑 개요
✅ PR 체크리스트
🚀 상세 작업 내용
📁 ETC
closed: #41