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/#9 닉네임 중복 체크 기능 구현 #40

Closed
wants to merge 2 commits into from
Closed

Feat/#9 닉네임 중복 체크 기능 구현 #40

wants to merge 2 commits into from

Conversation

1o18z
Copy link
Collaborator

@1o18z 1o18z commented Oct 24, 2023

이슈번호

close: #9

작업 내용 설명

  • 닉네임 중복 체크 기능 구현

리뷰어에게 한마디

@1o18z 1o18z added the feat 기능 개발 label Oct 24, 2023
@1o18z 1o18z added this to the 1차 스프린트 milestone Oct 24, 2023
@1o18z 1o18z self-assigned this Oct 24, 2023
@github-actions
Copy link

Test Results

1 tests   1 ✔️  1s ⏱️
1 suites  0 💤
1 files    0

Results for commit 5a19b5a.

@@ -94,6 +95,13 @@ private String checkProfileImage(String profileImage) {
return profileImage;
}

private String checkDuplicatedNickname(String nickname) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

굳이 nickname을 반환할 필요 있나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

checkDuplicatedUser 반환값이 void라 검증 메서드들을 void로 통일시키는게 좋을 것 같네요 ! 🙆🏻‍♀️🙆🏻‍♀️

@@ -80,7 +81,7 @@ public void logout(Long userId) {
refreshTokenRepository.deleteById(userId);
}

private void checkDuplicateUser(OAuthInfoResponse response) {
private void checkDuplicatedUser(OAuthInfoResponse response) {
if (userRepository.existsUserByOauthInfo_oauthProviderAndOauthInfo_oauthProviderId(
Copy link
Collaborator

@smartandhandsome smartandhandsome Oct 24, 2023

Choose a reason for hiding this comment

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

이거 OAuthInfo 에 OAuthProvider oauthProvider, String oauthProviderId 이렇게 두 개만 있고 조회도 그 두 개로 해서 userRepository.existsUserByOauthInfo 까지맨 해도 될 것 같은데 안되나용?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

메서드명을 단순화하면 스프링 데이터 JPA가 어떤 필드를 기준으로 사용자를 조회할지 알 수 없어 해당 이름은 줄이기 어렵습니다 !
너무 길긴하지만,, 추후에 QueryDSL로 개선하려고 일단은 놔뒀습니다 ! 🫡

Comment on lines +98 to +104
private String checkDuplicatedNickname(String nickname) {
if (userRepository.findUserByProfileNickname(nickname).isPresent()) {
throw new IllegalArgumentException("중복된 닉네임입니다.");
}
return nickname;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분 UserService에 checkDuplicatedNickname 랑 중복인데 UserService를 필드로 갖고 쓰는거 어때요?

@@ -80,7 +81,7 @@ public void logout(Long userId) {
refreshTokenRepository.deleteById(userId);
}

private void checkDuplicateUser(OAuthInfoResponse response) {
private void checkDuplicatedUser(OAuthInfoResponse response) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이건 AuthService보다 UserService에 두는게 어때요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

그러면 AuthService가 너무 많은 클래스에 의존하게 되어 AuthService에 해당 로직을 넣었는데, 그만큼 많은 책임을 가지고 있다는 의미같아서 말씀하신대로 해당 메서드는 UserService에 두고, 추후에 AuthService의 책임을 분리하려고 합니다 ! 🙆🏻‍♀️🫡

Copy link
Collaborator

@smartandhandsome smartandhandsome left a comment

Choose a reason for hiding this comment

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

수고하셨습니다. 의견 몇 개 남겨봤습니다
리뷰를 다른 방식으로 남겨볼려고 하다가 지저분하게 됐습니다,,,ㅎㅎ

@1o18z 1o18z closed this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능 개발
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🚀 [Feature] 닉네임 중복 체크 기능 구현
2 participants