Skip to content

[REFACTOR] : AI 투표 후에 투표 가능하도록 변경#250

Merged
yooooonshine merged 1 commit intodevelopfrom
feature/249-ai-vote-inprogress
Nov 9, 2025
Merged

[REFACTOR] : AI 투표 후에 투표 가능하도록 변경#250
yooooonshine merged 1 commit intodevelopfrom
feature/249-ai-vote-inprogress

Conversation

@yooooonshine
Copy link
Contributor

@yooooonshine yooooonshine commented Nov 9, 2025

개요

작업사항

  • AI 투표 후에 유저들이 투표가능하도록 변경

Summary by CodeRabbit

릴리스 노트

  • Refactor

    • 유사도 투표 처리 워크플로우 최적화 - 상태 업데이트 및 저장 로직 순서 조정
    • 투표 프로세싱 흐름 개선
  • Tests

    • 투표 처리 테스트 케이스 업데이트

@yooooonshine yooooonshine linked an issue Nov 9, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

Caution

Review failed

The pull request is closed.

📋 Walkthrough

투표 상태 관리 흐름을 리팩토링했습니다. 이전에는 AI 유사도 검증 요청 전송 시점에 투표 상태를 IN_PROGRESS로 변경했으나, 이제 요청 서비스에서 상태 업데이트 및 저장을 제거하고, 리스너에서 AI 응답을 처리할 때만 상태를 IN_PROGRESS로 설정하도록 변경했습니다.

📊 Changes

Cohort / File(s) 변경 요약
비즈니스 로직 - 요청 처리
src/main/java/hanium/modic/backend/domain/vote/service/AiSimilarityRequestService.java
메시지 발행 후 투표 상태를 IN_PROGRESS로 업데이트하고 저장하는 로직 제거. 투표 상태는 PENDING으로 유지
비즈니스 로직 - 응답 처리
src/main/java/hanium/modic/backend/domain/vote/listener/SimilarityCheckListener.java
VoteStatus 정적 임포트 추가, 엔티티 로드 후 상태를 IN_PROGRESS로 설정, 무효 응답 처리 추가, 가중치 적용 로깅 추가, 투표 엔티티 저장 로직 추가
테스트 - 요청 서비스
src/test/java/hanium/modic/backend/domain/vote/service/AiSimilarityRequestServiceTest.java
투표 상태 기댓값을 IN_PROGRESS에서 PENDING으로 변경, 저장 호출 검증 제거
테스트 - 응답 리스너
src/test/java/hanium/modic/backend/domain/vote/listener/SimilarityCheckListenerTest.java
투표 상태가 IN_PROGRESS로 유지되는지 검증 추가, 저장 메서드 호출 검증 추가
문서화
src/main/java/hanium/modic/backend/domain/auth/service/AuthService.java
로그인 및 이메일 인증 메서드에 설명 주석 추가

🔄 Sequence Diagram

sequenceDiagram
    participant Client
    participant AiSimilarityRequestService as Request Service
    participant RabbitMQ
    participant SimilarityCheckListener as Listener
    participant DB

    Client->>AiSimilarityRequestService: 유사도 검증 요청
    AiSimilarityRequestService->>DB: 투표 상태 조회 (PENDING)
    AiSimilarityRequestService->>RabbitMQ: 검증 DTO 발행
    Note over AiSimilarityRequestService: 상태 변경 없음<br/>PENDING 유지
    
    RabbitMQ->>SimilarityCheckListener: 메시지 수신
    SimilarityCheckListener->>DB: 투표 엔티티 로드
    SimilarityCheckListener->>SimilarityCheckListener: 상태를 IN_PROGRESS로 설정
    SimilarityCheckListener->>DB: AI 응답 요약 데이터 조회
    alt 응답 유효
        SimilarityCheckListener->>SimilarityCheckListener: 가중치 계산 및 적용
        SimilarityCheckListener->>DB: 투표 엔티티 저장 (IN_PROGRESS)
    else 응답 무효
        SimilarityCheckListener->>SimilarityCheckListener: 오류 처리
    end
Loading

⏱️ Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • 주의 필요 영역:
    • SimilarityCheckListener.java의 상태 전환 로직 및 엔티티 저장 순서 검증
    • 요청 서비스에서 제거된 상태 업데이트가 리스너에서 올바르게 처리되는지 확인
    • 테스트 케이스에서 PENDING/IN_PROGRESS 상태 전환이 예상대로 동작하는지 검증

📚 Possibly related PRs

  • AI 유사도 검사 비동기 처리 구현 #205 — AI 유사도 요청/응답 흐름을 수정하며 동일한 클래스들(AiSimilarityRequestService, SimilarityCheckListener)을 변경하고, 투표 상태 업데이트/저장 책임을 요청 서비스에서 리스너로 이동

🐰 Poem

투표는 이제 대기 상태에서 멋지게 기다려,
AI 응답이 올 때까지 PENDING으로 남아,
리스너가 "진행 중"이라 외치면,
IN_PROGRESS로 우아하게 변신해,
상태 관리의 춤이 더욱 맞춰진다네! ✨

✨ 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/249-ai-vote-inprogress

📜 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 bcc2cdc and 4a0a3a4.

📒 Files selected for processing (5)
  • src/main/java/hanium/modic/backend/domain/auth/service/AuthService.java (2 hunks)
  • src/main/java/hanium/modic/backend/domain/vote/listener/SimilarityCheckListener.java (4 hunks)
  • src/main/java/hanium/modic/backend/domain/vote/service/AiSimilarityRequestService.java (0 hunks)
  • src/test/java/hanium/modic/backend/domain/vote/listener/SimilarityCheckListenerTest.java (2 hunks)
  • src/test/java/hanium/modic/backend/domain/vote/service/AiSimilarityRequestServiceTest.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.

@yooooonshine yooooonshine merged commit da88b1f into develop Nov 9, 2025
1 of 2 checks passed
@yooooonshine yooooonshine deleted the feature/249-ai-vote-inprogress branch November 9, 2025 09:19
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.

AI 투표 전에는 투표 PENDING 상태로 두도록 변경

1 participant