Skip to content

Commit

Permalink
Fix: 탈퇴한 회원 오류 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
5jisoo committed Jan 9, 2024
1 parent 2c91e3d commit 4562de8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public enum BaseResponseStatus {

// member (3500 ~ 3599)
BLOCKED_MEMBER(false, 3500, "차단한 사용자입니다."),
DELETED_MEMBER(false, 3501, "탈퇴한 회원입니다."),

// post (3600 ~ 3699)
INVALID_POST_STATUS(false, 3600, "접근 불가능한 게시물 입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import static com.unibond.unibond.common.BaseEntityStatus.DELETED;
import static com.unibond.unibond.common.BaseResponseStatus.DELETED_MEMBER;
import static com.unibond.unibond.common.BaseResponseStatus.INVALID_MEMBER_ID;

@Service
Expand All @@ -29,7 +31,12 @@ public Member getLoginMember() throws BaseException {

Long loginId = Long.parseLong(httpServletRequest.getHeader("Authorization"));

return memberRepository.findById(loginId).orElseThrow(() -> new BaseException(INVALID_MEMBER_ID));
Member member
= memberRepository.findById(loginId).orElseThrow(() -> new BaseException(INVALID_MEMBER_ID));
if (member.getStatus().equals(DELETED)) {
throw new BaseException(DELETED_MEMBER);
}
return member;
}

public Member getLoginMemberFetchJoinDisease() throws BaseException {
Expand Down

0 comments on commit 4562de8

Please sign in to comment.