diff --git a/src/main/java/page/clab/api/domain/member/application/MemberService.java b/src/main/java/page/clab/api/domain/member/application/MemberService.java index b0c8eab2e..4de503bcb 100644 --- a/src/main/java/page/clab/api/domain/member/application/MemberService.java +++ b/src/main/java/page/clab/api/domain/member/application/MemberService.java @@ -229,11 +229,11 @@ private void setRandomPasswordAndSendEmail(Member member) { } private void checkMemberUniqueness(MemberRequestDto requestDto) { - if (memberRepository.findById(requestDto.getId()).isPresent()) + if (memberRepository.existsById(requestDto.getId())) throw new DuplicateMemberIdException("이미 사용 중인 아이디입니다."); - if (memberRepository.findByContact(requestDto.getContact()).isPresent()) + if (memberRepository.existsByContact(requestDto.getContact())) throw new DuplicateMemberContactException("이미 사용 중인 연락처입니다."); - if (memberRepository.findByEmail(requestDto.getEmail()).isPresent()) + if (memberRepository.existsByEmail(requestDto.getEmail())) throw new DuplicateMemberEmailException("이미 사용 중인 이메일입니다."); } diff --git a/src/main/java/page/clab/api/domain/member/dao/MemberRepository.java b/src/main/java/page/clab/api/domain/member/dao/MemberRepository.java index b88d98b6a..2a24bdbf3 100644 --- a/src/main/java/page/clab/api/domain/member/dao/MemberRepository.java +++ b/src/main/java/page/clab/api/domain/member/dao/MemberRepository.java @@ -12,7 +12,9 @@ @Repository public interface MemberRepository extends JpaRepository, MemberRepositoryCustom, QuerydslPredicateExecutor { - Optional findByContact(String contact); + boolean existsByContact(String contact); + + boolean existsByEmail(String email); Optional findByEmail(String email);