Skip to content

Commit

Permalink
[Refactor] #301 - 이미 가입된 마스터일 시 예외처리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
mjKim1229 committed Jul 14, 2023
1 parent 9bace1c commit 770d3e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ public interface MasterRepository extends JpaRepository<Master, UUID> {
List<Master> findMasterByStatus(BaseStatus status);

Optional<Master> findById(UUID id);

Optional<Master> findByPhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ public MasterCreateOutDTO registerMaster(MasterCreateInDTO dto) throws
BadPaddingException,
InvalidKeyException {

//이메일 확인
if (!masterRepository.findMasterByIdNumber(dto.getIdNumber()).isEmpty()) {
//아이디 중복확인
if (masterRepository.findMasterByIdNumber(dto.getIdNumber()).isPresent()) {
throw new MasterException(EXIST_IDNUMBER);
}

//휴대전화번호 중복확인
if (masterRepository.findByPhoneNumber(dto.getPhoneNumber()).isPresent()) {
throw new MasterException(EXIST_PHONENUMBER);
}

//닉네임 중복확인
if (!masterRepository.findMasterByNickname(dto.getNickname()).isEmpty()) {
if (masterRepository.findMasterByNickname(dto.getNickname()).isPresent()) {
throw new MasterException(EXIST_NICKNAME);
}

Expand Down

0 comments on commit 770d3e9

Please sign in to comment.