Skip to content

[Feature] 투표 streak 조회 API 구현#194

Merged
yooooonshine merged 1 commit intodevelopfrom
feature/193-implement-vote-streak
Oct 5, 2025
Merged

[Feature] 투표 streak 조회 API 구현#194
yooooonshine merged 1 commit intodevelopfrom
feature/193-implement-vote-streak

Conversation

@yooooonshine
Copy link
Contributor

@yooooonshine yooooonshine commented Oct 5, 2025

🧩 작업 내용 요약

투표 streak 조회 API 구현

🔍 관련 이슈


🧠 변경 이유 및 주요 포인트

  • 사용자의 현재 streak 조회 API 구현

🧪 테스트 및 검증

  • 단위 테스트 통과
  • 통합 테스트 통과
  • 로컬 서버 정상 구동 확인
  • Swagger 또는 Postman 테스트 완료

Summary by CodeRabbit

  • 신기능
    • 로그인 사용자를 위한 투표 연속 기록 조회 API 추가(/api/votes/streak). 현재 연속 투표 횟수와 보상 임계값을 반환하여 연속 보상 진행 상황을 확인할 수 있습니다.
  • 테스트
    • 투표 연속 기록 조회 로직에 대한 단위 테스트를 추가해 기본 동작을 검증했습니다.

@yooooonshine yooooonshine linked an issue Oct 5, 2025 that may be closed by this pull request
@yooooonshine yooooonshine merged commit 13cd9d5 into develop Oct 5, 2025
1 check passed
@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

투표 스트릭 조회 기능 추가. 서비스에 UserVoteStreakService 의존성 및 getVoteStreak 메서드 도입, 컨트롤러에 GET /api/votes/streak 엔드포인트 추가, 응답 DTO(GetVoteStreakResponse) 신설, 해당 서비스 메서드 단위 테스트 추가.

Changes

Cohort / File(s) Change Summary
Service Layer
src/main/java/.../domain/vote/service/VotingService.java
UserVoteStreakService 주입 추가. @Transactional(readOnly = true)getVoteStreak(Long userId) 신설. streak 값 조회 후 VoteProperties의 threshold와 함께 GetVoteStreakResponse 반환. 관련 import 추가.
Web API
src/main/java/.../web/vote/controller/VoteController.java
GET /api/votes/streak 엔드포인트 추가. 인증 사용자 조회 후 votingService.getVoteStreak 호출, AppResponse<GetVoteStreakResponse>로 응답. Swagger 문서화 및 import 추가.
DTO
src/main/java/.../web/vote/dto/response/GetVoteStreakResponse.java
public record GetVoteStreakResponse(int currentStreak, int rewardThreshold) 추가. 정적 팩토리 of(int, int) 제공.
Tests
src/test/java/.../domain/vote/service/VotingServiceTest.java
Mockito 기반 단위 테스트 추가. getVoteStreak_underThreshold에서 streak=2, threshold=3 mocking 및 반환값 검증.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Client
    participant VC as VoteController
    participant VS as VotingService
    participant US as UserVoteStreakService
    participant VP as VoteProperties

    Client->>VC: GET /api/votes/streak (Authenticated)
    VC->>VS: getVoteStreak(userId)
    VS->>US: getStreakCount(userId)
    US-->>VS: currentStreak
    VS->>VP: getStreakRewardCount()
    VP-->>VS: rewardThreshold
    VS-->>VC: GetVoteStreakResponse(currentStreak, rewardThreshold)
    VC-->>Client: 200 OK + AppResponse<GetVoteStreakResponse>

    rect rgba(231, 243, 255, 0.5)
    note right of VS: 신규 로직: 스트릭/임계값 집계 후 DTO 반환
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

깡총깡총, 로그 속 발자국 셋!
스트릭을 세고, 보상 문턱을 봤네.
컨트롤러 문 두드리면 OK 응답 뿅—
DTO 주머니에 숫자 둘 챙겨와요.
오늘도 한 표, 내일도 한 표, 기록은 이어지리! 🐇✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/193-implement-vote-streak

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71f1a06 and ab69391.

📒 Files selected for processing (4)
  • src/main/java/hanium/modic/backend/domain/vote/service/VotingService.java (3 hunks)
  • src/main/java/hanium/modic/backend/web/vote/controller/VoteController.java (2 hunks)
  • src/main/java/hanium/modic/backend/web/vote/dto/response/GetVoteStreakResponse.java (1 hunks)
  • src/test/java/hanium/modic/backend/domain/vote/service/VotingServiceTest.java (1 hunks)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

투표 스트릭 조회 API 구현

1 participant