Skip to content

✨ [OMF-337] 열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가#154

Merged
KJaeKwan merged 2 commits into
developfrom
feat/OMF-337
May 10, 2026
Merged

✨ [OMF-337] 열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가#154
KJaeKwan merged 2 commits into
developfrom
feat/OMF-337

Conversation

@KJaeKwan

@KJaeKwan KJaeKwan commented May 10, 2026

Copy link
Copy Markdown
Collaborator

✨ Related Issue

OMF-337 열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가


📌 Task Details

  • GET /v1/surveys/open-stats 엔드포인트 추가 (인증 불필요)
  • SurveyRepository에 ONGOING 설문 수 및 최대 promotionAmount 단일 쿼리 추가 (QueryDSL)
  • OpenSurveyStats DTO 및 OpenSurveyStatsResponse 응답 객체 추가
  • SurveyQuery 인터페이스 및 SurveyQueryService 구현체에 getOpenSurveyStats() 추가

응답 예시

{
  "openSurveyCount": 12,
  "maxRewardCoin": 500
}
  • openSurveyCount: 현재 ONGOING 상태인 설문 수
  • maxRewardCoin: ONGOING 설문 중 가장 높은 promotionAmount (설문이 없으면 0)

💬 Review Requirements (Optional)

  • surveysurvey_info를 LEFT JOIN 후 집계함수(COUNT, MAX)를 단일 쿼리로 처리하여 추가 DB 조회 없음

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 개방된 설문 통계를 조회하는 새로운 API 엔드포인트(GET /v1/surveys/open-stats)가 추가되었습니다. 이 엔드포인트는 현재 진행 중인 설문 수와 최대 보상 코인 정보를 조회합니다.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d7ded2f-d3b2-4d02-9a48-88b8ca0e53ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

검토 개요

이 변경 사항은 개방형 설문조사 통계 조회 기능을 추가합니다. 새로운 데이터 구조를 정의하고, 데이터베이스에서 설문조사 개수와 최대 보상 금액을 조회하는 repository 메서드를 구현한 후, service 계층을 통해 위임하고, 마지막으로 REST 엔드포인트로 노출합니다.

변경 사항

개방형 설문조사 통계 조회 기능

계층 / 파일 요약
데이터 계약
src/main/java/OneQ/OnSurvey/domain/survey/model/dto/OpenSurveyStats.java, src/main/java/OneQ/OnSurvey/domain/survey/model/response/OpenSurveyStatsResponse.java
openSurveyCountmaxRewardCoin 필드를 가진 OpenSurveyStats DTO 레코드와 이를 API 응답으로 매핑하는 OpenSurveyStatsResponse 레코드를 추가합니다.
Repository 계층
src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepository.java, src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java
findOpenSurveyStats() 메서드를 인터페이스에 선언하고, 진행 중인 설문조사 개수와 최대 보상 금액을 조회하는 데이터베이스 쿼리를 구현합니다.
Service 계층
src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQuery.java, src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java
SurveyQuery 인터페이스에 getOpenSurveyStats() 메서드를 추가하고, SurveyQueryService에서 repository 메서드에 위임하는 구현을 제공합니다.
Controller 계층
src/main/java/OneQ/OnSurvey/domain/survey/controller/SurveyStatsController.java
SurveyQuery 의존성을 주입하고, GET /v1/surveys/open-stats 엔드포인트를 추가하여 개방형 설문조사 통계를 조회하고 SuccessResponse로 래핑하여 반환합니다.

예상 코드 검토 노력

🎯 2 (Simple) | ⏱️ ~12분

제안 레이블

🌟feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 PR의 주요 변경사항(열려있는 설문 수 및 최고 참여 보상 코인 조회 API 추가)을 명확하고 간결하게 요약하고 있습니다.
Description check ✅ Passed PR 설명은 템플릿의 필수 섹션(Related Issue, Task Details)을 모두 포함하고 있으며, 구현된 기능과 응답 예시를 상세히 기록하고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/OMF-337

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@KJaeKwan KJaeKwan self-assigned this May 10, 2026
@KJaeKwan KJaeKwan added the 🌟feature 새로운 기능 label May 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd24245 and a7f4ce0.

📒 Files selected for processing (7)
  • src/main/java/OneQ/OnSurvey/domain/survey/controller/SurveyStatsController.java
  • src/main/java/OneQ/OnSurvey/domain/survey/model/dto/OpenSurveyStats.java
  • src/main/java/OneQ/OnSurvey/domain/survey/model/response/OpenSurveyStatsResponse.java
  • src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepository.java
  • src/main/java/OneQ/OnSurvey/domain/survey/repository/SurveyRepositoryImpl.java
  • src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQuery.java
  • src/main/java/OneQ/OnSurvey/domain/survey/service/query/SurveyQueryService.java

@KJaeKwan KJaeKwan merged commit 3dcd070 into develop May 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟feature 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant