diff --git a/server/src/main/kotlin/delta/codecharacter/server/user/UserService.kt b/server/src/main/kotlin/delta/codecharacter/server/user/UserService.kt index 7d01ed1..a160e52 100644 --- a/server/src/main/kotlin/delta/codecharacter/server/user/UserService.kt +++ b/server/src/main/kotlin/delta/codecharacter/server/user/UserService.kt @@ -200,6 +200,12 @@ class UserService( fun completeUserProfile(userId: UUID, completeProfileRequestDto: CompleteProfileRequestDto) { val (username, name, country, college, avatarId) = completeProfileRequestDto val user = userRepository.findFirstById(userId).get() + if (user.isProfileComplete) { + throw CustomException(HttpStatus.BAD_REQUEST, "User profile is already complete") + } + if (!publicUserService.isUsernameUnique(username)) { + throw CustomException(HttpStatus.BAD_REQUEST, "Username already taken") + } publicUserService.create(userId, username, name, country, college, avatarId) userRepository.save( user.copy(