From 94ac495438c16106c6958f04c643b6abb3872874 Mon Sep 17 00:00:00 2001 From: parksey Date: Sun, 26 Nov 2023 17:29:08 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20null=EC=B2=B4=ED=81=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=96=B4=EC=88=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/moabam/api/application/member/MemberService.java | 6 +++--- .../java/com/moabam/global/error/model/ErrorMessage.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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개여야 합니다. 관리자에게 문의하세요"),