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

Feature/177 : 애플로그인 사용자명 랜덤 세팅 #198

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

swa07016
Copy link
Member

@swa07016 swa07016 commented Mar 11, 2024

🚀 개요

애플로그인 시, 사용자명을 받을 수 없어 외부 API를 사용해 랜덤 사용자명을 세팅해줍니다.

⏳ 작업 내용

  • 애플로그인 사용자명 랜덤 세팅 로직 추가
  • 클라이언트 코드에서 NickNameClient(FeignClient)를 직접 의존하게 되면, 클라이언트 코드에서 응답 형식, 닉네임 생성 등의 관심사를 가지게 돼서 해당 관심사들을 adapter(NickNameGenerator)에 포함하여 제공하도록 설계
  • NickNameGenerator 단위 테스트 작성 (NickNameClient는 mocking하여 의존성 격리)

📝 논의사항

@swa07016 swa07016 linked an issue Mar 11, 2024 that may be closed by this pull request
1 task
@swa07016 swa07016 requested review from ahnsugyeong and CYY1007 March 11, 2024 08:33
@swa07016 swa07016 self-assigned this Mar 11, 2024
@swa07016 swa07016 added the ✨ feature New feature or request label Mar 11, 2024
@@ -87,8 +92,12 @@ private Member loginWithApple(MemberRequest.LoginDTO request) {
Optional<Member> foundMember =
memberRepository.findBySocialIdAndSocialType(appleSocialId, SocialType.APPLE);

String nickName = "";
List<String> nickNameWords = nickNameClient.getNickName(NICK_NAME_FORMAT, NICK_NAME_COUNT, NICK_NAME_MAX_LENGTH).getWords();
if(!nickNameWords.isEmpty()) nickName = nickNameWords.get(0);
Copy link
Member

Choose a reason for hiding this comment

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

닉네임이 빈 리스트인 경우는 어떻게 될까요?
nickNameWords.stream().findFirst();를 이용하여 null인 경우에 대해 예외처리를 안해도 될지 궁금합니다!

*/
private String getOneRandomNickNameWithDetails(int maxLength) {
List<String> nickNameWords = nickNameClient.getNickName(NICK_NAME_FORMAT, NICK_NAME_COUNT, maxLength).getWords();
if (!nickNameWords.isEmpty()) return nickNameWords.get(0);
Copy link
Member

@CYY1007 CYY1007 Mar 11, 2024

Choose a reason for hiding this comment

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

앞선 리뷰와 동일한데, nickNameWords.stream().findFirst();를 사용하는 방식에 대해서는 어떻게 생각하시나요?
빈 리스트의 경우 ""를 반환할지 아니면 기본 닉네임을 반환할지도 고민이 되네요

Copy link
Member

@ahnsugyeong ahnsugyeong left a comment

Choose a reason for hiding this comment

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

용욱님 말씀처럼 닉네임 생성에 실패한 경우 기본 값을 반환하는 방법도 좋은 것 같아요!
수고하셨습니다~😀👍🏻

@swa07016
Copy link
Member Author

넵! 코멘트 반영해서 null 안 넘어오게 응답(words)에 빈 리스트 할당하고, 기본 닉네임 하품하는 프로도로 세팅해두었습니다!👍

@swa07016 swa07016 merged commit f7a2466 into develop Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 [feature] 애플로그인 사용자명 랜덤 세팅
3 participants