From c3354545cde8806371cc07a10c2bf95fd75c9c61 Mon Sep 17 00:00:00 2001 From: wonseok Date: Fri, 31 Jan 2025 15:07:46 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20editProfile=20nickname=20c?= =?UTF-8?q?onflict=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/toyProject7/karrot/profile/service/ProfileService.kt | 2 +- .../com/toyProject7/karrot/user/service/UserService.kt | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/kotlin/com/toyProject7/karrot/profile/service/ProfileService.kt b/src/main/kotlin/com/toyProject7/karrot/profile/service/ProfileService.kt index c7b12e2..1f34c57 100644 --- a/src/main/kotlin/com/toyProject7/karrot/profile/service/ProfileService.kt +++ b/src/main/kotlin/com/toyProject7/karrot/profile/service/ProfileService.kt @@ -69,7 +69,7 @@ class ProfileService( user: User, request: EditProfileRequest, ): Profile { - if (userService.existUserEntityByNickname(request.nickname)) { + if (user.nickname == request.nickname) { throw ProfileEditNicknameConflictException() } diff --git a/src/main/kotlin/com/toyProject7/karrot/user/service/UserService.kt b/src/main/kotlin/com/toyProject7/karrot/user/service/UserService.kt index e3ca5a6..1510012 100644 --- a/src/main/kotlin/com/toyProject7/karrot/user/service/UserService.kt +++ b/src/main/kotlin/com/toyProject7/karrot/user/service/UserService.kt @@ -179,9 +179,4 @@ class UserService( fun getUserEntityByNickname(nickname: String): UserEntity { return userRepository.findByNickname(nickname) ?: throw UserNotFoundException() } - - @Transactional - fun existUserEntityByNickname(nickname: String): Boolean { - return userRepository.existsByNickname(nickname) - } }