feat: 관리자 검색 키워드 통계 화면 추가#104
Conversation
|
Warning Review limit reached
Next review available in: 39 minutes Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable usage-based reviews in Billing to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). 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 see our Fair Usage Limits Policy for further information, and refer to the rate limits docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough검색 키워드 일별 카운트 upsert 기능과 어드민 통계 조회 화면을 추가한다. DB에 Changes검색 키워드 일별 집계 및 어드민 통계 기능
Sequence Diagram(s)sequenceDiagram
participant Browser
participant AdminSearchKeywordStatisticsController
participant AdminSearchKeywordStatisticsService
participant AdminSearchKeywordStatisticsReaderAdapter
participant SearchKeywordCountRepository
Browser->>AdminSearchKeywordStatisticsController: GET /admin/statistics/search-keywords
AdminSearchKeywordStatisticsController->>AdminSearchKeywordStatisticsService: getStatistics()
AdminSearchKeywordStatisticsService->>AdminSearchKeywordStatisticsReaderAdapter: readStatistics(today)
AdminSearchKeywordStatisticsReaderAdapter->>SearchKeywordCountRepository: findStatistics(today) [native LEFT JOIN]
SearchKeywordCountRepository-->>AdminSearchKeywordStatisticsReaderAdapter: List<AdminSearchKeywordStatisticsProjection>
AdminSearchKeywordStatisticsReaderAdapter-->>AdminSearchKeywordStatisticsService: List<SearchKeywordStatistic>
AdminSearchKeywordStatisticsService-->>AdminSearchKeywordStatisticsController: AdminSearchKeywordStatisticsResult
AdminSearchKeywordStatisticsController-->>Browser: search-keyword-statistics 뷰 렌더링
sequenceDiagram
participant SearchKeywordCountCommandService
participant SearchKeywordCountStore
participant SearchKeywordDailyCountStoreAdapter
participant SearchKeywordDailyCountRepository
Note over SearchKeywordCountCommandService: increase(keyword) 호출 시
SearchKeywordCountCommandService->>SearchKeywordCountStore: increase(normalizedKeyword)
SearchKeywordCountCommandService->>SearchKeywordDailyCountStoreAdapter: increase(normalizedKeyword, LocalDate.now(SEOUL_ZONE))
SearchKeywordDailyCountStoreAdapter->>SearchKeywordDailyCountRepository: INSERT ... ON CONFLICT DO UPDATE upsert
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
scripts/db/03-keyword-counts.sql (1)
8-9: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
uk_keyword_counts_keyword와 중복되는 인덱스는 제거하세요.Line 5의 UNIQUE 제약이 이미
keyword인덱스를 만듭니다. 이 인덱스를 하나 더 두면 검색 집계 쓰기마다 같은 키를 두 번 갱신해서 저장공간과 쓰기 비용만 늘어납니다.♻️ 제안 변경
-CREATE INDEX IF NOT EXISTS idx_keyword_counts_keyword - ON keyword_counts (keyword);;🤖 Prompt for 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. In `@scripts/db/03-keyword-counts.sql` around lines 8 - 9, Remove the redundant keyword index from the keyword_counts migration: the UNIQUE constraint on keyword already creates an index, so the extra CREATE INDEX in the script should be deleted to avoid duplicate write overhead. Update the SQL in 03-keyword-counts.sql so only the unique index created by the table definition remains, and make sure no separate idx_keyword_counts_keyword definition is left behind.
🤖 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/com/zimdugo/locker/infrastructure/persistence/SearchKeywordCountRepository.java`:
- Around line 21-30: The native query in SearchKeywordCountRepository uses
projection aliases without quotes, which can break mapping to
AdminSearchKeywordStatisticsProjection getters. Update the SELECT aliases in the
repository query to use fixed quoted names for totalCount and todayCount so
PostgreSQL preserves the exact case and the projection properties resolve
correctly.
---
Nitpick comments:
In `@scripts/db/03-keyword-counts.sql`:
- Around line 8-9: Remove the redundant keyword index from the keyword_counts
migration: the UNIQUE constraint on keyword already creates an index, so the
extra CREATE INDEX in the script should be deleted to avoid duplicate write
overhead. Update the SQL in 03-keyword-counts.sql so only the unique index
created by the table definition remains, and make sure no separate
idx_keyword_counts_keyword definition is left behind.
🪄 Autofix (Beta)
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
Run ID: 0ea2d579-f82d-4c0d-a006-509edf9cc747
📒 Files selected for processing (17)
scripts/db/03-keyword-counts.sqlsrc/main/java/com/zimdugo/admin/application/AdminSearchKeywordStatisticsService.javasrc/main/java/com/zimdugo/admin/application/dto/AdminSearchKeywordStatisticsResult.javasrc/main/java/com/zimdugo/admin/entrypoint/AdminSearchKeywordStatisticsController.javasrc/main/java/com/zimdugo/locker/application/search/SearchKeywordCountCommandService.javasrc/main/java/com/zimdugo/locker/domain/search/SearchKeywordDailyCountStore.javasrc/main/java/com/zimdugo/locker/domain/search/SearchKeywordStatistic.javasrc/main/java/com/zimdugo/locker/domain/search/SearchKeywordStatisticsReader.javasrc/main/java/com/zimdugo/locker/infrastructure/adapter/AdminSearchKeywordStatisticsReaderAdapter.javasrc/main/java/com/zimdugo/locker/infrastructure/adapter/SearchKeywordDailyCountStoreAdapter.javasrc/main/java/com/zimdugo/locker/infrastructure/persistence/AdminSearchKeywordStatisticsProjection.javasrc/main/java/com/zimdugo/locker/infrastructure/persistence/SearchKeywordCountRepository.javasrc/main/java/com/zimdugo/locker/infrastructure/persistence/SearchKeywordDailyCountEntity.javasrc/main/java/com/zimdugo/locker/infrastructure/persistence/SearchKeywordDailyCountRepository.javasrc/main/resources/application-local.yamlsrc/main/resources/templates/admin/layout.htmlsrc/main/resources/templates/admin/search-keyword-statistics.html
✨ 작업 내용 한 줄 요약
🛠️ 작업 내용
집계 > 검색 키워드페이지를 추가했습니다.keyword_daily_counts)가 저장되도록 확장했습니다.03-keyword-counts.sql)에keyword_daily_counts테이블 및 인덱스를 추가했습니다.🧠 기술적 의사결정
SearchKeywordStatisticsReader포트를 통해 접근하도록 구성하여 Application 계층이 Infrastructure에 직접 의존하지 않도록 했습니다.ddl-auto=validate)을 고려하여 신규 테이블은 엔티티 자동 생성이 아닌 SQL 스크립트로 관리하도록 했습니다.📚 참고 자료 (선택)
📷 스크린샷 (선택)
Summary by CodeRabbit
New Features
Bug Fixes
Chores