From c22d1cc6fb9a4a106759dfaea71d837d51a41a63 Mon Sep 17 00:00:00 2001 From: ckkim817 Date: Thu, 14 Nov 2024 00:49:01 +0900 Subject: [PATCH] =?UTF-8?q?[HOTFIX]=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= =?UTF-8?q?=ED=95=98=EB=A9=B0=20=EB=88=84=EB=9D=BD=EB=90=9C=20ROLE=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SENIOR_PENDING --- .../domain/member/service/MemberService.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/sopt/seonyakServer/domain/member/service/MemberService.java b/src/main/java/org/sopt/seonyakServer/domain/member/service/MemberService.java index a0e4046..cb8d930 100644 --- a/src/main/java/org/sopt/seonyakServer/domain/member/service/MemberService.java +++ b/src/main/java/org/sopt/seonyakServer/domain/member/service/MemberService.java @@ -92,9 +92,9 @@ private MemberInfoResponse getMemberInfoResponse( // Access Token을 생성할 때, 해당 유저의 회원가입 여부를 판단 private LoginSuccessResponse getTokenDto(final MemberInfoResponse memberInfoResponse) { - try { - Member member; + Member member; + try { if (isExistingMember(memberInfoResponse.socialType(), memberInfoResponse.socialId())) { member = memberRepository.findBySocialTypeAndSocialIdOrThrow( memberInfoResponse.socialType(), @@ -109,23 +109,17 @@ private LoginSuccessResponse getTokenDto(final MemberInfoResponse memberInfoResp member = memberRepository.save(member); } - - String role = determineRole(member); - String nickname = determineNickname(member); - - return getTokenByMemberId(role, member.getId(), nickname); - } catch (DataIntegrityViolationException e) { // DB 무결성 제약 조건 위반 예외 - Member member = memberRepository.findBySocialTypeAndSocialIdOrThrow( + member = memberRepository.findBySocialTypeAndSocialIdOrThrow( memberInfoResponse.socialType(), memberInfoResponse.socialId() ); + } - String role = determineRole(member); - String nickname = determineNickname(member); + String role = determineRole(member); + String nickname = determineNickname(member); - return getTokenByMemberId(role, member.getId(), nickname); - } + return getTokenByMemberId(role, member.getId(), nickname); } private boolean isExistingMember( @@ -149,7 +143,7 @@ private String determineRole(Member member) { if (member.getSenior() == null) { return member.getPhoneNumber() != null ? "JUNIOR" : null; } else { - return "SENIOR"; + return member.getSenior().getCatchphrase() != null ? "SENIOR" : "SENIOR_PENDING"; } }