✨ [OMF-337] 열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가#154
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Walkthrough검토 개요이 변경 사항은 개방형 설문조사 통계 조회 기능을 추가합니다. 새로운 데이터 구조를 정의하고, 데이터베이스에서 설문조사 개수와 최대 보상 금액을 조회하는 repository 메서드를 구현한 후, service 계층을 통해 위임하고, 마지막으로 REST 엔드포인트로 노출합니다. 변경 사항개방형 설문조사 통계 조회 기능
예상 코드 검토 노력🎯 2 (Simple) | ⏱️ ~12분 제안 레이블
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: 2
🤖 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/OneQ/OnSurvey/domain/survey/model/dto/OpenSurveyStats.java`:
- Around line 7-9: 현재 OpenSurveyStats.of(Long openSurveyCount, Integer
maxRewardCoin)에서 maxRewardCoin만 null일 때 0으로 대체하고 있어 openSurveyCount는 null에
취약합니다; of 메서드에서 openSurveyCount가 null이면 0L로 기본값을 사용하도록 처리하고(new OpenSurveyStats
호출 시 전달되는 첫번째 인자에 null 체크 적용), 기존의 maxRewardCoin null 처리(maxRewardCoin != null ?
maxRewardCoin : 0)와 동일한 스타일로 일관성 있게 구현하세요.
In
`@src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java`:
- Around line 324-336: The null-checks in findOpenSurveyStats are overly
defensive; simplify by treating SQL COUNT as non-null: compute Tuple result,
then set Long count = (result == null) ? 0L : result.get(survey.count()); and
Integer maxCoin = (result == null) ? null :
result.get(surveyInfo.promotionAmount.max()); finally return
OpenSurveyStats.of(count, maxCoin); update the method (referencing
findOpenSurveyStats, Tuple result, survey.count(),
surveyInfo.promotionAmount.max(), and OpenSurveyStats.of) accordingly.
🪄 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.yml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ea18588d-b806-4fd4-bb5d-50c101c5fe93
📒 Files selected for processing (7)
src/main/java/OneQ/OnSurvey/domain/survey/controller/SurveyStatsController.javasrc/main/java/OneQ/OnSurvey/domain/survey/model/dto/OpenSurveyStats.javasrc/main/java/OneQ/OnSurvey/domain/survey/model/response/OpenSurveyStatsResponse.javasrc/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepository.javasrc/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.javasrc/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQuery.javasrc/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java
✨ Related Issue
OMF-337 열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가
📌 Task Details
GET /v1/surveys/open-stats엔드포인트 추가 (인증 불필요)SurveyRepository에 ONGOING 설문 수 및 최대promotionAmount단일 쿼리 추가 (QueryDSL)OpenSurveyStatsDTO 및OpenSurveyStatsResponse응답 객체 추가SurveyQuery인터페이스 및SurveyQueryService구현체에getOpenSurveyStats()추가응답 예시
{ "openSurveyCount": 12, "maxRewardCoin": 500 }openSurveyCount: 현재ONGOING상태인 설문 수maxRewardCoin:ONGOING설문 중 가장 높은promotionAmount(설문이 없으면0)💬 Review Requirements (Optional)
survey와survey_info를 LEFT JOIN 후 집계함수(COUNT,MAX)를 단일 쿼리로 처리하여 추가 DB 조회 없음Summary by CodeRabbit
릴리스 노트
GET /v1/surveys/open-stats)가 추가되었습니다. 이 엔드포인트는 현재 진행 중인 설문 수와 최대 보상 코인 정보를 조회합니다.