feat: 채널 추천 결과 저장 API 구현 - #133
Conversation
|
Warning Review limit reached
Next review available in: 21 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough추천 계산 결과를 Changes추천 결과 저장
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant RecommendationController
participant RecommendationServiceImpl
participant ChannelRecommendationRepository
participant Database
Client->>RecommendationController: POST /api/v1/recommendations
RecommendationController->>RecommendationServiceImpl: userId, onboardingId 전달
RecommendationServiceImpl->>RecommendationServiceImpl: 추천 계산 및 스냅샷 생성
RecommendationServiceImpl->>ChannelRecommendationRepository: 기존 추천 삭제 및 새 추천 저장
ChannelRecommendationRepository->>Database: channel_recommendations 저장
Database-->>ChannelRecommendationRepository: 저장 결과 반환
RecommendationServiceImpl-->>RecommendationController: SavedRecommendationResponse 반환
RecommendationController-->>Client: 201 CREATED
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #133 +/- ##
============================================
+ Coverage 88.44% 88.83% +0.39%
- Complexity 469 491 +22
============================================
Files 105 107 +2
Lines 1437 1541 +104
Branches 111 119 +8
============================================
+ Hits 1271 1369 +98
- Misses 122 125 +3
- Partials 44 47 +3
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/chaeso/zip/server/recommendation/application/RecommendationServiceImpl.java`:
- Around line 76-89: Serialize the onboarding save flow in save by acquiring a
pessimistic or equivalent onboarding-scoped lock before calculate, so
findOwnedOnboarding, deletion, calculation, and persistence cannot run
concurrently for the same onboarding. Add a unique constraint on (onboarding_id,
rank) to protect against conflicting saves, and add an integration test covering
concurrent creation of different channel sets for one onboarding on PostgreSQL.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 07bd6f10-b642-40fe-97d5-0e5c3a8ecb07
📒 Files selected for processing (20)
src/main/java/chaeso/zip/server/auth/infrastructure/security/SecurityConfig.javasrc/main/java/chaeso/zip/server/common/config/ResponseWrapperSchemaCustomizer.javasrc/main/java/chaeso/zip/server/recommendation/application/RecommendationService.javasrc/main/java/chaeso/zip/server/recommendation/application/RecommendationServiceImpl.javasrc/main/java/chaeso/zip/server/recommendation/application/dto/RecommendationItemResponse.javasrc/main/java/chaeso/zip/server/recommendation/application/dto/SavedRecommendationResponse.javasrc/main/java/chaeso/zip/server/recommendation/domain/RecommendationSnapshot.javasrc/main/java/chaeso/zip/server/recommendation/domain/entity/ChannelRecommendation.javasrc/main/java/chaeso/zip/server/recommendation/domain/repository/ChannelRecommendationRepository.javasrc/main/java/chaeso/zip/server/recommendation/presentation/RecommendationApiDocs.javasrc/main/java/chaeso/zip/server/recommendation/presentation/RecommendationController.javasrc/main/java/chaeso/zip/server/recommendation/presentation/dto/SaveRecommendationRequest.javasrc/main/resources/db/migration/V15__create_channel_recommendations.sqlsrc/test/java/chaeso/zip/server/auth/infrastructure/security/SecurityConfigIntegrationTest.javasrc/test/java/chaeso/zip/server/docs/OpenApiContractTest.javasrc/test/java/chaeso/zip/server/recommendation/application/RecommendationServiceImplTest.javasrc/test/java/chaeso/zip/server/recommendation/domain/ChannelRecommendationRepositoryTest.javasrc/test/java/chaeso/zip/server/recommendation/presentation/RecommendationControllerTest.javasrc/test/java/chaeso/zip/server/support/ChannelCatalogFixture.javasrc/test/java/chaeso/zip/server/support/OnboardingFixture.java
|
코드 리뷰 결과 (자동 리뷰) 계층 아키텍처(ArchUnit 규칙), 정확성, JPA/영속성, Flyway 마이그레이션, 보안(인가/소유권/동시성), API 계약, 테스트 커버리지를 확인했습니다. 반드시 수정해야 할 항목 🟡 Minor
확인한 주요 포인트 (문제 없음)
|
🔗 관련 이슈
Closes #128
📝 작업 내용
channel_recommendations에 스냅샷으로 저장 (순위 1~8)(onboarding_id, channel_id)유니크 제약PUBLIC_GET_PATHS추가data, 오류 응답 래퍼의error를 required로 노출 /RecommendationItemResponse의 선택 필드가null로 내려가던 것을 생략하도록 함V15__create_channel_recommendations.sql/V16_add_channel_recommendation_rank_unique.sql추가✅ 체크리스트
💬 리뷰 참고 사항
RecommendationItemResponse에@JsonInclude(NON_NULL)을 적용해 값이 없는 필드가 null 대신 키 자체가 빠집니다. 원래 스펙과 실제 응답이 어긋나 있는 부분도 수정했습니다.Summary by CodeRabbit