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) - } }