diff --git a/src/main/java/com/moabam/api/application/member/MemberService.java b/src/main/java/com/moabam/api/application/member/MemberService.java index 148fb592..ce4ca41a 100644 --- a/src/main/java/com/moabam/api/application/member/MemberService.java +++ b/src/main/java/com/moabam/api/application/member/MemberService.java @@ -27,8 +27,8 @@ import com.moabam.global.error.exception.BadRequestException; import com.moabam.global.error.exception.ConflictException; import com.moabam.global.error.exception.NotFoundException; -import com.moabam.global.error.model.ErrorMessage; +import io.micrometer.common.util.StringUtils; import lombok.RequiredArgsConstructor; @Service @@ -100,8 +100,8 @@ public void modifyInfo(AuthMember authMember, ModifyMemberRequest modifyMemberRe } private void validateNickname(String nickname) { - if (Objects.nonNull(nickname) && memberRepository.existsByNickname(nickname)) { - throw new ConflictException(ErrorMessage.CONFLICT_NICKNAME); + if (StringUtils.isEmpty(nickname) && memberRepository.existsByNickname(nickname)) { + throw new ConflictException(NICKNAME_CONFLICT); } } diff --git a/src/main/java/com/moabam/global/error/model/ErrorMessage.java b/src/main/java/com/moabam/global/error/model/ErrorMessage.java index becce7fe..3cfa68f2 100644 --- a/src/main/java/com/moabam/global/error/model/ErrorMessage.java +++ b/src/main/java/com/moabam/global/error/model/ErrorMessage.java @@ -35,7 +35,7 @@ public enum ErrorMessage { MEMBER_NOT_FOUND_BY_MANAGER_OR_NULL("방의 매니저거나 회원이 존재하지 않습니다."), MEMBER_ROOM_EXCEED("참여할 수 있는 방의 개수가 모두 찼습니다."), UNLINK_REQUEST_FAIL_ROLLBACK_SUCCESS("카카오 연결 요청 실패로 Rollback하였습니다."), - CONFLICT_NICKNAME("이미 존재하는 닉네임입니다."), + NICKNAME_CONFLICT("이미 존재하는 닉네임입니다."), INVALID_DEFAULT_SKIN_SIZE("기본 스킨은 2개여야 합니다. 관리자에게 문의하세요"),