Skip to content

Fix/#125 service code refactor#135

Merged
5solbin merged 8 commits into
ValanSee:devfrom
5solbin:fix/#125-service_code_refactor
May 6, 2026
Merged

Fix/#125 service code refactor#135
5solbin merged 8 commits into
ValanSee:devfrom
5solbin:fix/#125-service_code_refactor

Conversation

@5solbin
Copy link
Copy Markdown
Contributor

@5solbin 5solbin commented Apr 29, 2026

작업 내용

🔧 N+1 쿼리 제거

  • getHotIssueVote(), getTrendingVote()에서 findAll() 후 루프로 save()하던 패턴 제거
  • VoteRepositoryCustomfindHotIssueVote(), findTrendingVote() 추가
  • QueryDSL LEFT JOIN + COALESCE로 단일 쿼리로 개선
    • 정렬 기준: totalVoteCount + commentGroup.totalCommentCount (점수 동일 시 최신순)

🧹 코드 품질 개선

  • getVoteDetailById()System.out.println 디버그 로그 3개 제거
  • getTrendingVote() 불필요한 @Transactional 제거 (데이터 변경 없음)
  • processVote()[cite: image_...] 잔존 주석 제거

✅ 테스트 케이스 보강

  • VoteServiceImplTest: 9개 → 17개
    • 공백/초과 제목 검증, 처음 투표 시 포인트 지급/미지급
    • getVoteDetailById 비로그인/투표완료 케이스
    • updatePinStatus 권한없음/기존핀해제/핀해제
  • ReportServiceImplTest: 5개 → 7개
    • 중복 신고, 존재하지 않는 대상 신고
  • CommentLikeServiceImplTest: 2개 → 4개
    • 존재하지 않는 회원/댓글 좋아요 시도
  • VoteControllerTest: GlobalExceptionHandler 응답 형식에 맞게 $.type 검증 제거

변경 파일

  • VoteRepositoryCustom.java — 인터페이스 메서드 2개 추가
  • VoteRepositoryImpl.java — QueryDSL 구현체 추가
  • VoteServiceImpl.java — N+1 제거, 로그/주석 정리
  • VoteServiceImplTest.java, ReportServiceImplTest.java, CommentLikeServiceImplTest.java, VoteControllerTest.java — 테스트 보강

5solbin added 8 commits April 28, 2026 13:36
- VoteServiceImplTest: 공백 제목, 포인트 지급/미지급, getVoteDetailById(비로그인/투표완료),
  updatePinStatus(권한없음/기존핀해제/핀해제) 케이스 추가 (9 → 17개)
- ReportServiceImplTest: 중복 투표 신고, 존재하지 않는 대상 신고 케이스 추가 (5 → 7개)
- CommentLikeServiceImplTest: 존재하지 않는 회원/댓글 좋아요 케이스 추가 (2 → 4개)
- VoteControllerTest: GlobalExceptionHandler 응답 형식에 맞게 $.type 검증 제거
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5c993fe2-d059-432b-b651-35423c20a8b9

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@5solbin 5solbin merged commit b1ccc9f into ValanSee:dev May 6, 2026
1 check passed
@5solbin 5solbin deleted the fix/#125-service_code_refactor branch May 22, 2026 04:48
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.

1 participant