fix: GPA 상태 조회에 모학교명 반환#799
Conversation
- GPA 상태 조회 응답에 사용자의 모학교명을 포함 - 모학교가 없는 사용자는 모학교명을 null로 반환 - GPA 상태 조회 테스트를 검증 목적별로 분리
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
- 모학교 조회 로직을 HomeUniversityQueryService로 분리 - GPA 상태 조회 시 학교 미인증 사용자는 예외 처리 - 마이페이지는 미인증 사용자 모학교명을 null로 유지 - GPA 상태 조회 테스트를 학교 인증 정책에 맞게 수정
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/university/service/HomeUniversityQueryService.java (1)
37-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
HomeUniversity전용 오류 코드(HOME_UNIVERSITY_NOT_FOUND)를 사용하는 게 더 정확합니다.이 메서드는
HomeUniversity를 조회하는데, 누락 시 일반적인UNIVERSITY_NOT_FOUND("대학교를 찾을 수 없습니다.")를 던지고 있어요.ErrorCode에는 이미HOME_UNIVERSITY_NOT_FOUND("협정 대학교를 찾을 수 없습니다.")라는 더 구체적인 코드가 마련되어 있으니, 이 쪽을 쓰면 협정 대학 조회 실패임을 한눈에 알 수 있어 추적과 클라이언트 처리가 편해집니다.다만
homeUniversityId는 외래키로 보장되어 실제로는 거의 발생하지 않는 케이스이니, 우선순위는 높지 않은 다듬기 정도로 봐주세요.♻️ 제안 변경
-import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND; +import static com.example.solidconnection.common.exception.ErrorCode.HOME_UNIVERSITY_NOT_FOUND;private String findNameById(Long homeUniversityId) { HomeUniversity homeUniversity = homeUniversityRepository.findById(homeUniversityId) - .orElseThrow(() -> new CustomException(UNIVERSITY_NOT_FOUND)); + .orElseThrow(() -> new CustomException(HOME_UNIVERSITY_NOT_FOUND)); return homeUniversity.getName(); }🤖 Prompt for 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. In `@src/main/java/com/example/solidconnection/university/service/HomeUniversityQueryService.java` around lines 37 - 41, The findNameById method in HomeUniversityQueryService is throwing the generic UNIVERSITY_NOT_FOUND error for a HomeUniversity lookup; switch it to the more specific HOME_UNIVERSITY_NOT_FOUND CustomException so the failure clearly matches the entity being queried. Update the orElseThrow in findNameById to use the HomeUniversity-specific error code, keeping the rest of the lookup and return flow unchanged.
🤖 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.
Nitpick comments:
In
`@src/main/java/com/example/solidconnection/university/service/HomeUniversityQueryService.java`:
- Around line 37-41: The findNameById method in HomeUniversityQueryService is
throwing the generic UNIVERSITY_NOT_FOUND error for a HomeUniversity lookup;
switch it to the more specific HOME_UNIVERSITY_NOT_FOUND CustomException so the
failure clearly matches the entity being queried. Update the orElseThrow in
findNameById to use the HomeUniversity-specific error code, keeping the rest of
the lookup and return flow unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 08e2f290-568a-4bbb-a747-b11ea3e7d3ec
📒 Files selected for processing (5)
src/main/java/com/example/solidconnection/common/exception/ErrorCode.javasrc/main/java/com/example/solidconnection/score/service/ScoreService.javasrc/main/java/com/example/solidconnection/siteuser/service/MyPageService.javasrc/main/java/com/example/solidconnection/university/service/HomeUniversityQueryService.javasrc/test/java/com/example/solidconnection/score/service/ScoreServiceTest.java
관련 이슈
작업 내용
homeUniversityName)을 추가했습니다.homeUniversityId가 존재하는 경우HomeUniversity를 조회해 모학교명을 응답에 포함하도록 수정했습니다.homeUniversityName을null로 반환하도록 처리했습니다.null인지 검증특이 사항
homeUniversityName필드가 추가되므로, 프론트엔드에서 해당 필드를 사용할 수 있습니다.homeUniversityId가 저장되어 있는데 실제 모학교 데이터가 존재하지 않는 경우에는 기존 예외 정책에 맞춰UNIVERSITY_NOT_FOUND예외가 발생합니다../gradlew compileTestJava통과./gradlew test --tests "com.example.solidconnection.score.service.ScoreServiceTest"는 Docker/Testcontainers 환경을 찾지 못해 실행 실패리뷰 요구사항 (선택)
getGpaScoreStatus에서 GPA 상태 목록 조회와 모학교명 조회를 함께 수행하는 흐름이 API 응답 요구사항에 적절한지 확인 부탁드립니다.homeUniversityName = null처리 방식이 프론트엔드 기대값과 맞는지 확인 부탁드립니다.