Skip to content

Conversation

@whqtker
Copy link
Member

@whqtker whqtker commented Jan 25, 2026

관련 이슈

작업 내용

{{URL}}/univ-apply-infos/search/filter 를 무효화하고, {{URL}}/univ-apply-infos/search/text?value= 로 통합합니다. 지원 대학 검색은 오직 {{URL}}/univ-apply-infos/search/text?value= 를 통해서 진행됩니다.

기존 필터 검색의 조건은 languageTestType, testScore, countryCode 인데, 프론트 측에서 필터링을 진행해주신다고 합니다.

추가로 해당 지원 대학의 협정 대학 또한 응답에 포함시켰습니다(지원 대학 검색, 좋아요한 지원 대학 등등).

변경에 따른 테스트 코드 또한 수정했습니다.

간접 참조 방식에서 발생하는 N+1 문제를 막고자 Map 방식을 사용했는데, 코드가 너무 중복되는 것 같아 @ManyToOne + fetch join을 사용하도록 변경했습니다. 지원 학교를 조회하는 경우 협정 대학 또한 같이 따라오는 관계라고 생각했습니다(== 어차피 같이 조회됨).

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Walkthrough

  1. 필터 기반 검색 제거. 이 PR은 UnivApplyInfoController의 필터 검색 엔드포인트와 해당 DTO(UnivApplyInfoFilterSearchRequest)를 삭제했습니다.
  2. 텍스트 검색으로 전환. UnivApplyInfoQueryService는 필터식 메서드를 제거하고 텍스트 기반 검색 메서드(searchUnivApplyInfoByText)로 대체했습니다.
  3. 응답 모델 확장 및 팩토리명 변경. UnivApplyInfoPreviewResponse에 homeUniversityName 필드를 추가하고 정적 팩토리 메서드 이름을 from에서 of로 변경했습니다.
  4. 도메인 연관 변경 및 레포지토리 보강. UnivApplyInfo의 homeUniversityId를 HomeUniversity와의 @ManyToOne 연관으로 교체했고 HomeUniversityRepository를 추가했으며 여러 쿼리와 커스텀 리포지토리 구현에 homeUniversity에 대한 left join을 도입했습니다.
  5. 테스트 및 픽스처 업데이트. 테스트용 HomeUniversity 픽스처와 빌더를 추가하고 UnivApplyInfo 관련 픽스처/테스트들에서 homeUniversity를 반영하도록 수정했으며, 필터 관련 테스트를 제거했습니다.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 분

Suggested reviewers

  • Gyuhyeok99
  • lsy1307
  • wibaek
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% 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 제목이 변경의 핵심을 명확하게 전달하며, 대학 검색 응답 수정이라는 주요 변경사항을 잘 요약하고 있습니다.
Description check ✅ Passed PR 설명이 템플릿 구조를 잘 따르고 있으며, 관련 이슈, 작업 내용, 특이 사항을 포함하고 있어 충분히 완성도 있습니다.
Linked Issues check ✅ Passed PR의 모든 주요 변경사항(필터 검색 엔드포인트 제거, 텍스트 기반 단일 엔드포인트 통합, 협정 대학 정보 추가, N+1 최적화)이 이슈 #623의 요구사항을 충족하고 있습니다.
Out of Scope Changes check ✅ Passed 모든 코드 변경사항이 이슈 #623의 범위 내에서 이루어졌으며, 범위를 벗어난 변경사항은 발견되지 않습니다.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@whqtker whqtker self-assigned this Jan 25, 2026
@whqtker whqtker marked this pull request as ready for review January 25, 2026 06:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In
`@src/main/java/com/example/solidconnection/university/service/LikedUnivApplyInfoService.java`:
- Around line 61-69: In getHomeUniversityMap, avoid calling
homeUniversityRepository.findAllByIdIn when homeUniversityIds is empty: after
computing homeUniversityIds (from UnivApplyInfo::getHomeUniversityId), if the
list is empty return an empty immutable map (Map.of()) immediately; otherwise
proceed to call homeUniversityRepository.findAllByIdIn(...) and collect to a map
with HomeUniversity::getId and Function.identity().

In
`@src/main/java/com/example/solidconnection/university/service/UnivApplyInfoRecommendService.java`:
- Around line 100-108: getHomeUniversityMap may call the repository with an
empty homeUniversityIds list causing an unnecessary query or an empty IN clause
error; add a guard: after computing homeUniversityIds (variable name) check if
it's empty and if so return Map.of() immediately, otherwise proceed to call
homeUniversityRepository.findAllByIdIn(...) and collect to the map as before.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/example/solidconnection/university/service/LikedUnivApplyInfoService.java (1)

36-50: homeUniversity fetch join 누락으로 인한 N+1 문제 발생.

현재 코드에서 다음과 같은 성능 문제가 확인됩니다:

  1. findUnivApplyInfosBySiteUserId 쿼리가 fetch join 없이 일반 JOIN만 수행하고 있습니다.
  2. UnivApplyInfoPreviewResponse.of() 메서드가 univApplyInfo.getHomeUniversity().getName()을 호출하여 homeUniversity 관계를 접근합니다.
  3. UnivApplyInfo.homeUniversity는 LAZY 로딩으로 설정되어 있어, 반복된 쿼리가 발생합니다.

동일한 엔티티를 다루는 UnivApplyInfoFilterRepositoryImpl의 다른 메서드들은 이미 .leftJoin(univApplyInfo.homeUniversity, homeUniversity).fetchJoin()으로 올바르게 구현되어 있습니다. 동일한 패턴을 적용해 주세요.

🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/university/service/UnivApplyInfoQueryService.java (1)

50-54: 검색 기능 구현이 올바르게 진행되고 있습니다.

확인 결과 요청하신 두 가지 사항이 모두 적절하게 구현되어 있습니다:

  1. 빈 검색어 처리: 이미 구현됨
    null 또는 isBlank() 상태이면 전체 대학 지원 정보를 ID 오름차순으로 반환하도록 처리되어 있습니다.

  2. 검색 대상 필드 확인: 의도된 대로 동작 중
    findAllByTextUnivApplyInfo.koreanName을 기준으로 검색하고 있으며, 추가로 국가명과 지역명도 함께 검색하는 구조입니다(우선순위 랭킹 적용).

선택 사항: 입력 정규화 제안

현재 코드에서 text.trim()을 한 번 더 추가하면, 사용자 입력의 앞뒤 공백을 제거하여 더 깔끔한 검색 경험을 제공할 수 있습니다. 다만 이는 필수사항이 아니며, 선호에 따라 적용하셔도 됩니다.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/test/java/com/example/solidconnection/university/fixture/HomeUniversityFixtureBuilder.java`:
- Around line 14-27: The create() method in HomeUniversityFixtureBuilder can
call findByName(null) or attempt to save a null/empty name; add a precondition
at the start of create() that validates the instance field name is non-null and
not blank (e.g., trim and check length) and throw an IllegalStateException (or
similar) with a clear message like "Home university name must be set" to fail
fast and avoid ambiguous errors; update any tests if they relied on null
behavior.

Comment on lines +14 to +27
private String name;

public HomeUniversityFixtureBuilder homeUniversity() {
return new HomeUniversityFixtureBuilder(homeUniversityRepository);
}

public HomeUniversityFixtureBuilder name(String name) {
this.name = name;
return this;
}

public HomeUniversity create() {
return homeUniversityRepository.findByName(name)
.orElseGet(() -> homeUniversityRepository.save(new HomeUniversity(null, name)));
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

1) 이름 미설정 시 예외 원인이 흐려질 수 있습니다.
- name이 없으면 findByName(null) 또는 null 저장 시도가 발생할 수 있어요.
- create()에서 선제 검증을 해두면 테스트 디버깅이 훨씬 쉬워집니다.

🔧 제안: create()에서 명시 검증 추가
+import java.util.Objects;
@@
     public HomeUniversity create() {
+        Objects.requireNonNull(name, "homeUniversity name must be set");
         return homeUniversityRepository.findByName(name)
                 .orElseGet(() -> homeUniversityRepository.save(new HomeUniversity(null, name)));
     }
🤖 Prompt for AI Agents
In
`@src/test/java/com/example/solidconnection/university/fixture/HomeUniversityFixtureBuilder.java`
around lines 14 - 27, The create() method in HomeUniversityFixtureBuilder can
call findByName(null) or attempt to save a null/empty name; add a precondition
at the start of create() that validates the instance field name is non-null and
not blank (e.g., trim and check length) and throw an IllegalStateException (or
similar) with a clear message like "Home university name must be set" to fail
fast and avoid ambiguous errors; update any tests if they relied on null
behavior.

@whqtker whqtker merged commit db0287f into solid-connection:develop Jan 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 대학 검색 응답 수정

1 participant