diff --git a/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepository.java b/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepository.java index 03f785ca..3f8ab192 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepository.java +++ b/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepository.java @@ -10,4 +10,5 @@ public interface MemberCustomRepository { Optional findNotDeletedBySocialId(String socialId); Optional findNotDeletedByEmail(String email); + Optional findNotDeletedByMemberId(Long id); } diff --git a/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepositoryImpl.java index 0149fdcc..9c841321 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/member/domain/repository/MemberCustomRepositoryImpl.java @@ -43,4 +43,13 @@ public Optional findNotDeletedByEmail(String email) { .where(member.isDeleted.eq(false)) .fetchOne()); } + + @Override + public Optional findNotDeletedByMemberId(Long id) { + return Optional.ofNullable(queryFactory + .selectFrom(member) + .where(member.memberId.eq(id)) + .where(member.isDeleted.eq(false)) + .fetchOne()); + } } diff --git a/src/main/java/com/moing/backend/domain/member/domain/service/MemberGetService.java b/src/main/java/com/moing/backend/domain/member/domain/service/MemberGetService.java index 33dab9ef..8c78c8b8 100644 --- a/src/main/java/com/moing/backend/domain/member/domain/service/MemberGetService.java +++ b/src/main/java/com/moing/backend/domain/member/domain/service/MemberGetService.java @@ -19,6 +19,6 @@ public Member getMemberBySocialId(String socialId){ } public Member getMemberByMemberId(Long memberId) { - return memberRepository.findByMemberId(memberId).orElseThrow(()->new NotFoundBySocialIdException()); + return memberRepository.findNotDeletedByMemberId(memberId).orElseThrow(()->new NotFoundBySocialIdException()); } }