-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(user): desperate user service #42
Conversation
워크스루이 풀 리퀘스트는 사용자 관련 서비스 클래스들의 리팩토링을 포함합니다. 세 개의 새로운 서비스 클래스( 변경 사항
시 (Poem)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
application/src/main/kotlin/com/threedays/application/user/service/UserProfileService.kt (1)
22-33
:userRepository.save(it)
호출 중복을 줄이기 위한 리팩토링 제안각 메서드에서
userRepository.save(it)
호출이 반복되고 있습니다. 코드의 중복을 줄이고 유지보수성을 높이기 위해 이 부분을 별도의 공통 함수나 확장 함수로 추출하는 것을 고려해보세요.application/src/main/kotlin/com/threedays/application/user/service/UserProfileImageService.kt (1)
38-45
:also
와let
함수 사용의 일관성 유지
CompleteUserProfileImageUpload
메서드에서let
을 사용하여userRepository.save(it)
를 호출하고 있고, 다른 메서드에서는also
를 사용하고 있습니다. 코드의 일관성을 위해 동일한 스코프 함수를 사용하는 것을 추천드립니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
application/src/main/kotlin/com/threedays/application/user/service/UserDesiredPartnerService.kt
(1 hunks)application/src/main/kotlin/com/threedays/application/user/service/UserProfileImageService.kt
(1 hunks)application/src/main/kotlin/com/threedays/application/user/service/UserProfileService.kt
(1 hunks)application/src/main/kotlin/com/threedays/application/user/service/UserService.kt
(2 hunks)
🔇 Additional comments (4)
application/src/main/kotlin/com/threedays/application/user/service/UserProfileService.kt (2)
38-41
: userRepository.save(it)
호출 중복을 줄이기 위한 리팩토링 제안
putProfileWidget
메서드에서도 동일하게 userRepository.save(it)
호출이 반복됩니다. 앞서 언급한 리팩토링 방안을 적용하여 코드의 일관성과 가독성을 향상시킬 수 있습니다.
46-49
: userRepository.save(it)
호출 중복을 줄이기 위한 리팩토링 제안
deleteProfileWidget
메서드에서도 userRepository.save(it)
호출이 반복되고 있습니다. 이전에 제안한 리팩토링을 고려하여 코드의 중복을 제거하시기 바랍니다.
application/src/main/kotlin/com/threedays/application/user/service/UserProfileImageService.kt (1)
38-45
: userRepository.save(it)
호출 중복을 줄이기 위한 리팩토링 제안
여기서도 userRepository.save(it)
호출이 반복되고 있습니다. 이전에 제안한 리팩토링 방안을 적용하여 코드의 중복을 최소화하고 유지보수성을 향상시킬 수 있습니다.
application/src/main/kotlin/com/threedays/application/user/service/UserDesiredPartnerService.kt (1)
16-24
: userRepository.save(it)
호출 중복을 줄이기 위한 리팩토링 제안
다른 서비스 클래스들과 마찬가지로 userRepository.save(it)
호출이 반복되고 있습니다. 앞서 제안된 리팩토링 방안을 참고하여 코드의 중복을 제거하고 일관성을 유지하시기 바랍니다.
application/src/main/kotlin/com/threedays/application/user/service/UserService.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
application/src/main/kotlin/com/threedays/application/user/service/UserService.kt (1)
Line range hint
24-52
: 비즈니스 로직에 대한 예외 처리와 문서화가 필요합니다.현재 구현은 기능적으로는 문제가 없으나, 다음 사항들을 고려해주시면 좋겠습니다:
- 입력값 유효성 검증 (예: 전화번호 형식, 생년월일 범위 등)
- 존재하지 않는 company/location ID에 대한 예외 처리
- 비즈니스 로직에 대한 문서화 (KDoc 추가)
다음과 같은 개선을 제안드립니다:
+ /** + * 새로운 사용자를 등록하고 로그인 토큰을 발급합니다. + * + * @param command 사용자 등록에 필요한 정보 + * @throws EntityNotFoundException 존재하지 않는 company 또는 location ID 입력 시 + * @throws IllegalArgumentException 유효하지 않은 입력값 제공 시 + * @return 발급된 액세스 토큰과 리프레시 토큰 + */ @Transactional override fun invoke(command: RegisterUser.Command): RegisterUser.Result { + require(isValidPhoneNumber(command.phoneNumber)) { "유효하지 않은 전화번호 형식입니다" } + require(isValidBirthYear(command.userBirthYear)) { "유효하지 않은 생년월일입니다" } + val userCompany: Company? = command.userCompanyId?.let { companyQueryRepository.get(it) } val userLocations: List<Location> = command.userLocationIds.map { locationQueryRepository.get(it) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
application/src/main/kotlin/com/threedays/application/user/service/UserService.kt
(1 hunks)
🔇 Additional comments (1)
application/src/main/kotlin/com/threedays/application/user/service/UserService.kt (1)
Line range hint 1-22
: 클래스 구조와 의존성이 잘 정리되었습니다!
서비스 클래스가 사용자 등록이라는 단일 책임에 맞게 깔끔하게 리팩토링되었습니다. 필요한 의존성만 주입받고 있으며, 포트와 어댑터 패턴을 잘 준수하고 있습니다.
|
Summary by CodeRabbit
New Features
Bug Fixes
Refactor