Skip to content

Commit

Permalink
[HOTFIX] 리팩토링하며 누락된 ROLE 분기 추가
Browse files Browse the repository at this point in the history
SENIOR_PENDING
  • Loading branch information
ckkim817 committed Nov 13, 2024
1 parent 145cd36 commit c22d1cc
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(
Expand All @@ -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";
}
}

Expand Down

0 comments on commit c22d1cc

Please sign in to comment.