-
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
[WEAV-34] ✨ 직장 검색 API #25
Conversation
Walkthrough이 변경 사항은 Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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: 2
🧹 Outside diff range and nitpick comments (2)
domain/src/main/kotlin/com/threedays/domain/user/repository/CompanyQueryRepository.kt (1)
8-12
: LGTM! 메서드 서명이 명확하고 적절합니다.메서드 서명이 잘 설계되었으며, 페이지네이션을 위한 커서 기반 접근 방식을 적절히 구현하고 있습니다. 반환 타입인
Pair<List<Company>, Company.Id?>
는 검색 결과와 다음 커서를 함께 반환하기에 적합합니다.메서드에 KDoc 주석을 추가하여 문서화를 개선하는 것이 좋겠습니다. 다음과 같이 추가할 수 있습니다:
/** * 회사 이름으로 회사를 검색합니다. * * @param name 검색할 회사 이름 * @param next 페이지네이션을 위한 다음 회사 ID (선택적) * @param limit 반환할 최대 결과 수 * @return 검색된 회사 목록과 다음 페이지 커서 (있는 경우)의 쌍 */ fun searchCompanies( name: String, next: Company.Id?, limit: Int ): Pair<List<Company>, Company.Id?>bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/user/CompaniesController.kt (1)
22-41
:searchCompanies
메서드 구현이 잘 되었습니다. 오류 처리를 고려해보세요.메서드 구현이 전반적으로 잘 되어 있습니다. 주입된 리포지토리를 올바르게 사용하고 있으며, 도메인 엔티티를 API 응답 객체로 매핑하는 과정도 적절합니다. 선택적
next
매개변수 처리도 잘 되어 있습니다.다만, 오류 처리에 대한 부분이 보이지 않습니다. 예를 들어, 리포지토리 호출 시 발생할 수 있는 예외나 잘못된 입력값에 대한 처리를 추가하는 것이 좋겠습니다.
오류 처리 로직을 추가하는 것에 대해 어떻게 생각하시나요? 필요하다면 예외 처리 코드 예시를 제공해 드릴 수 있습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/user/CompaniesController.kt (1 hunks)
- domain/src/main/kotlin/com/threedays/domain/user/repository/CompanyQueryRepository.kt (1 hunks)
- infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt (1 hunks)
- infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/repository/CompanyJpaRepository.kt (1 hunks)
🧰 Additional context used
🔇 Additional comments (5)
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/repository/CompanyJpaRepository.kt (1)
3-3
: Kotlin JDSL 지원 추가에 대한 승인
KotlinJdslJpqlExecutor
를 확장함으로써CompanyJpaRepository
의 기능이 향상되었습니다. 이 변경은 다음과 같은 이점을 제공합니다:
- 더 유연하고 타입 안전한 쿼리 구성 가능
- 복잡한 쿼리를 직접 리포지토리에서 작성할 수 있는 능력
- 기존 JPA 작업과의 호환성 유지
이 변경은 코드베이스의 쿼리 기능을 향상시키는 긍정적인 개선입니다.
Also applies to: 10-10
bootstrap/api/src/main/kotlin/com/threedays/bootstrap/api/user/CompaniesController.kt (3)
1-10
: 패키지 선언과 임포트가 적절합니다.패키지 선언이 정확하고 필요한 모든 클래스와 인터페이스가 올바르게 임포트되었습니다. 사용되지 않는 임포트도 없어 깔끔합니다.
12-15
: 클래스 선언과 생성자가 잘 구현되었습니다.
@RestController
어노테이션의 사용이 적절하며,CompaniesApi
인터페이스를 구현하여 API 계약을 준수하고 있습니다. 생성자를 통한 의존성 주입도 좋은 방식입니다.
17-21
:searchCompanies
메서드 시그니처가 적절합니다.메서드 시그니처가 API 계약을 잘 준수하고 있습니다.
ResponseEntity
를 사용하여 HTTP 응답을 더 세밀하게 제어할 수 있게 한 점이 좋습니다.infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt (1)
37-38
:next
조건의 Null 처리 확인 필요
next?.let { ... }
구문을 사용하여next
가 null이 아닐 때만 조건을 추가하고 있습니다. 하지만whereAnd
에 null이 전달될 경우 예상치 못한 동작이 발생할 수 있으니, Null 처리가 올바르게 이루어지고 있는지 확인이 필요합니다.다음 스크립트를 실행하여 Null 조건이 JPQL DSL에서 올바르게 처리되는지 확인하세요:
✅ Verification successful
next
의 Null 처리 확인 완료무한 문제가 발견되지 않았으며,
next?.let { ... }
구문을 사용한 null 처리가 올바르게 수행되고 있습니다.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 설명: JPQL DSL에서 null 조건 처리가 올바른지 확인 # 테스트: null 조건을 포함한 쿼리 생성 시 예외가 발생하지 않아야 합니다. # 예시 코드로 테스트 쿼리 작성 cat <<EOT > Test.kt import com.linecorp.kotlinjdsl.dsl.jpql.jpql import com.linecorp.kotlinjdsl.querymodel.jpql.select.SelectQuery val next: Long? = null val query: SelectQuery<CompanyJpaEntity> = jpql { select(entity(CompanyJpaEntity::class)) .from(entity(CompanyJpaEntity::class)) .whereAnd( path(CompanyJpaEntity::name).like("%test%"), next?.let { path(CompanyJpaEntity::id).gt(it) } ) } EOT # 컴파일 테스트 kotlinc Test.kt -cp kotlin-jdsl.jarLength of output: 119
Script:
#!/bin/bash # 설명: whereAnd 함수가 null을 올바르게 처리하는지 확인하기 위해 코드를 검색합니다. # 테스트: whereAnd 함수에 null이 전달되는 호출을 찾고, 이러한 호출이 올바르게 처리되고 있는지 확인합니다. # whereAnd 함수 호출 중 null을 인자로 사용하는 경우를 검색 rg 'whereAnd\s*\(\s*null' .Length of output: 29
...nce/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt
Show resolved
Hide resolved
...nce/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
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
🧹 Outside diff range and nitpick comments (1)
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt (1)
23-48
: LGTM:searchCompanies
메서드가 잘 구현되었습니다.메서드가 페이지네이션을 포함한 검색 기능을 올바르게 구현하고 있습니다. Kotlin JDSL을 사용하여 타입 안전한 쿼리 구성을 제공하는 것이 좋습니다.
개선 제안:
- 이전 리뷰 코멘트에서 언급된 대로,
Pair
대신 데이터 클래스를 사용하여 반환 값을 더 명확하게 표현할 수 있습니다. 이는 가독성을 향상시키고 유지보수를 용이하게 할 것입니다.다음과 같은 데이터 클래스를 사용하는 것을 고려해보세요:
data class SearchCompaniesResult( val companies: List<Company>, val nextId: Company.Id? )그리고 메서드 시그니처와 반환문을 다음과 같이 변경할 수 있습니다:
override fun searchCompanies( name: String, next: Company.Id?, limit: Int ): SearchCompaniesResult { // ... existing implementation ... return SearchCompaniesResult(result.take(limit), nextId) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
infrastructure/persistence/src/main/kotlin/com/threedays/persistence/user/adapter/CompanyQueryPersistenceAdapter.kt (2)
3-6
: LGTM: 새로운 import 문이 적절히 추가되었습니다.Kotlin JDSL 관련 import 문들이
searchCompanies
메서드 구현에 필요한 기능을 제공하기 위해 적절히 추가되었습니다.Also applies to: 11-11
18-20
: LGTM: 생성자가 적절히 업데이트되었습니다.
entityManager
와jdslRenderContext
파라미터가 추가되어 JPQL 쿼리 실행에 필요한 의존성을 제공합니다. 이는searchCompanies
메서드의 새로운 구현과 일관성이 있습니다.
Summary by CodeRabbit
새로운 기능
버그 수정
문서화