Skip to content

Conversation

@lsy1307
Copy link
Contributor

@lsy1307 lsy1307 commented Sep 22, 2025

  • findAllByRegionCodeAnKeywords 메서드에서 term을 고려하여 조회하도록 수정

관련 이슈

작업 내용

  • GET /application에서 term을 고려하지 않아 중복 대학이 조회되던 문제를 수정하였습니다.

특이 사항

리뷰 요구사항 (선택)

- findAllByRegionCodeAnKeywords 메서드에서 term을 고려하여 조회하도록 수정
@lsy1307 lsy1307 self-assigned this Sep 22, 2025
@lsy1307 lsy1307 added the 버그 Something isn't working label Sep 22, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

Walkthrough

  1. ApplicationQueryService 변경: 키워드가 null 또는 공백일 때 빈 리스트로 변환하고, 값이 있으면 리스트에 담아 전달하도록 StringUtils를 사용해 처리했습니다.
  2. 레포지토리 인터페이스 변경: UnivApplyInfoFilterRepository의 메서드명이 findAllByRegionCodeAndKeywordsAndTerm(String regionCode, List<String> keywords, String term)로 바뀌었습니다.
  3. 레포지토리 구현 변경: UnivApplyInfoFilterRepositoryImpl의 시그니처가 동일하게 업데이트되었고 쿼리의 where절에 univApplyInfo.term.eq(term) 조건이 추가되었습니다.
  4. 쿼리 호출 경로 변경: ApplicationQueryService에서 UnivApplyInfo를 조회할 때 새로운 term 파라미터가 전달되도록 호출이 변경되었고 이후 관련 조회(지원서 조회 등)에도 term이 계속 전파됩니다.
  5. 기존 동작 유지: UnivApplyInfo 조회 결과가 없을 경우의 조기 반환 로직은 기존과 동일하게 유지됩니다.
  6. 테스트 수정: 테스트명이 변경되고 현재 학기 지원서만 조회되도록 케이스가 추가·수정되어 기대 결과가 현재 학기 지원서만 포함되도록 업데이트되었습니다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • nayonsoso
  • Gyuhyeok99
  • wibaek

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed 제목은 중복 대학 조회 문제 해결이라는 주된 변경 사항을 명확히 요약하고 있어 변경점과 일치하며 간결합니다.
Linked Issues Check ✅ Passed 코드 변경 사항은 term 파라미터를 추가하여 findAllByRegionCodeAndKeywordsAndTerm 메서드를 통해 중복 대학 조회 문제를 해결함으로써 이슈 #498의 핵심 목표를 충족합니다.
Out of Scope Changes Check ✅ Passed 변경된 메서드 시그니처, term 필터 추가, 서비스와 테스트 수정 등은 모두 중복 대학 오류 수정이라는 이슈 범위 내에 있으며 불필요한 외부 변경은 없습니다.
Description Check ✅ Passed 제공된 PR 설명은 관련 이슈(#498)와 주요 수정 내용을 포함한 작업 내용 섹션을 갖추고 있어 템플릿의 필수 항목을 대체로 충족합니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 fe4a11e and 746c585.

📒 Files selected for processing (1)
  • src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/test/java/com/example/solidconnection/application/service/ApplicationQueryServiceTest.java (1)

252-288: 중복 방지 검증 시나리오 보강 좋습니다

  1. 현재 학기 전용 지원서 목록만 남도록 검증해 요구 사항에 딱 맞게 확인할 수 있어요.
  2. 이전 학기 데이터가 빈 리스트로 분리돼 중복이 제거됐는지 한눈에 파악되네요.

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.

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

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/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (1)

34-52: 수정 필요 — term이 null/blank인 경우 필터 누락 방지: termEq 헬퍼 사용으로 일관화하세요.

위치: src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (findAllByRegionCodeAndKeywords, 약 라인 34–52); 파일에 termEq 헬퍼가 이미 정의·사용됨(라인 93, 159).

  1. 변경 — termEq으로 대체.
 return queryFactory
     .selectFrom(univApplyInfo)
     .join(univApplyInfo.university, university).fetchJoin()
     .join(university.country, country).fetchJoin()
     .leftJoin(univApplyInfo.languageRequirements, languageRequirement).fetchJoin()
-     .where(
-             regionCodeEq(country, regionCode)
-                     .and(countryOrUniversityContainsKeyword(country, university, keywords))
-                     .and(univApplyInfo.term.eq(term))
-     )
+     .where(
+             regionCodeEq(country, regionCode),
+             countryOrUniversityContainsKeyword(country, university, keywords),
+             termEq(univApplyInfo, term)
+     )
     .distinct()
     .fetch();
  1. 검증 — 단위 테스트 추가로 확인.
    term이 null, 빈 문자열, 정상값인 케이스를 분리해 필터링 결과(중복/누락 포함)가 기대대로 나오는지 확인하세요.

  2. 권고(선택) — languageRequirements의 fetchJoin 검토.
    languageRequirements는 to‑many이므로 fetchJoin이 중복/성능 이슈를 만들 수 있으니 필요 시 별도 조회나 배치 사이즈로 조정하세요.

🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepository.java (1)

9-14: 시그니처 확장 검증 완료 및 네이밍 통일 권장

  1. 시그니처 확장 검증
    모든 호출처가 새 파라미터(term 포함)를 올바르게 전달하고 있음을 확인했습니다.
  2. 네이밍 통일 권장
    인터페이스(countryKoreanNames)와 구현(countryCodes)의 파라미터명이 달라 혼선 우려가 있으니 일관된 이름으로 변경하세요.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd50d4 and 7b1fd90.

📒 Files selected for processing (3)
  • src/main/java/com/example/solidconnection/application/service/ApplicationQueryService.java (1 hunks)
  • src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

확인했습니다 ~

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

변경사항에 대한 테스트코드가 생기면 좋겠습니다!
예를 들어 이전 학기 대학 리스트는 응답에서 제외된다 등이요!

나머진 간단한 코드 개선 의견만 남겼습니다!

public interface UnivApplyInfoFilterRepository {

List<UnivApplyInfo> findAllByRegionCodeAndKeywords(String regionCode, List<String> keywords);
List<UnivApplyInfo> findAllByRegionCodeAndKeywords(String regionCode, List<String> keywords, String term);
Copy link
Contributor

Choose a reason for hiding this comment

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

함수명도 바꿔주시면 좋을 거 같습니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다!

SiteUser siteUser = siteUserRepository.findById(siteUserId)
.orElseThrow(() -> new CustomException(USER_NOT_FOUND));
List<UnivApplyInfo> univApplyInfos = universityFilterRepository.findAllByRegionCodeAndKeywords(regionCode, List.of(keyword));
List<String> keywords = (keyword == null || keyword.isBlank()) ? List.of() : List.of(keyword);
Copy link
Contributor

Choose a reason for hiding this comment

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

List<String> keywords = StringUtils.hasText(keyword) ? List.of(keyword) : List.of();

List<String> keywords = StringUtils.isNotBlank(keyword) ? List.of(keyword) : List.of();

이거 중 하나로 해서 좀더 간결하게 표현하는 건 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다!

@Gyuhyeok99
Copy link
Contributor

추가로 사소하지만 pr명
fix : 대학교 중복 오류 수정 -> fix: 대학교 중복 오류 수정

로 수정해주실 수 있을까요?

@lsy1307 lsy1307 changed the title fix : 대학교 중복 오류 수정 fix: 대학교 중복 오류 수정 Sep 28, 2025
- 메서드명에 Term 추가
- 컨벤션 수정
@lsy1307
Copy link
Contributor Author

lsy1307 commented Sep 28, 2025

추가로 사소하지만 pr명 fix : 대학교 중복 오류 수정 -> fix: 대학교 중복 오류 수정

로 수정해주실 수 있을까요?

수정했습니다! 그리고 지금 보니 application쪽 테스트 코드는 좀 전반적인 수정이 필요할 것 같아서 다른 pr에 추가하겠습니다!

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04c8e38 and fe4a11e.

📒 Files selected for processing (3)
  • src/main/java/com/example/solidconnection/application/service/ApplicationQueryService.java (2 hunks)
  • src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepository.java (1 hunks)
  • src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: nayonsoso
PR: solid-connection/solid-connect-server#486
File: src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java:166-178
Timestamp: 2025-08-26T05:00:56.556Z
Learning: UnivApplyInfo의 텍스트 검색 기능에서는 University.koreanName이 아닌 UnivApplyInfo.koreanName을 검색 대상으로 사용하는 것이 의도된 설계이다.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
src/main/java/com/example/solidconnection/application/service/ApplicationQueryService.java (1)

49-51: 키워드 가드 덕분에 마음이 놓이네요!
null·blank 키워드를 빈 리스트로 털어내니 이제 NPE 공포에서 해방입니다. 덕분에 호출부가 훨씬 단단해졌어요.

Comment on lines 46 to 49
regionCodeEq(country, regionCode)
.and(countryOrUniversityContainsKeyword(country, university, keywords))
.and(univApplyInfo.term.eq(term))
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

term null 처리 누락으로 즉시 예외 위험!
term 값이 null이면 Querydsl이 "eq(null) is not allowed" 예외를 곧장 던져서 /application 조회가 바로 깨집니다. 기존 인터페이스에는 term이 없었기 때문에 호출부에서 관성적으로 null을 넣을 여지가 있고, 설정 누락 시에도 즉시 장애가 나니 사전에 가드가 필요해요. 간단하게 null을 검증한 뒤 쿼리를 빌드하도록 바꿔 주세요.

@@
-        return queryFactory
+        if (term == null) {
+            throw new IllegalArgumentException("term must not be null");
+        }
+
+        return queryFactory
                 .selectFrom(univApplyInfo)
@@
-                                .and(univApplyInfo.term.eq(term))
+                                .and(univApplyInfo.term.eq(term))
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/university/repository/custom/UnivApplyInfoFilterRepositoryImpl.java
around lines 46 to 49, the code calls univApplyInfo.term.eq(term) without
guarding term which causes Querydsl to throw "eq(null) is not allowed" when term
is null; change the query construction to only add the term predicate when term
is non-null (e.g., create a termEq(term) helper that returns the predicate when
term!=null or null otherwise, or conditionally chain the .and(...) only if term
!= null) so the query builder never calls eq(null).

@Gyuhyeok99
Copy link
Contributor

수정했습니다! 그리고 지금 보니 application쪽 테스트 코드는 좀 전반적인 수정이 필요할 것 같아서 다른 pr에 추가하겠습니다!

저는 변경사항과 함께 테스트 코드가 같이 추가되는 게 맞다고 생각해서 여기서 간단하게라도 작성하고 리팩토링하면 좋겠습니다..!

@lsy1307
Copy link
Contributor Author

lsy1307 commented Oct 10, 2025

수정했습니다! 그리고 지금 보니 application쪽 테스트 코드는 좀 전반적인 수정이 필요할 것 같아서 다른 pr에 추가하겠습니다!

저는 변경사항과 함께 테스트 코드가 같이 추가되는 게 맞다고 생각해서 여기서 간단하게라도 작성하고 리팩토링하면 좋겠습니다..!

아공 제가 이제야 확인했는데 이전_학기_지원자는_조회되지_않는다가 이미 있어서 중복될 것 같은데 이 메서드를 좀 수정해볼까요?

- 명칭 변경
- 정확하게 현재 학기만 조회되는지 확인하도록 로직 수정
Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@lsy1307 lsy1307 merged commit cfe71a2 into solid-connection:develop Oct 31, 2025
2 checks passed
Gyuhyeok99 added a commit that referenced this pull request Nov 4, 2025
fix: PostRepository & CommentRepository의 일부 메서드의 정렬 순서 오류 해결 (#522) 
refactor: 이메일 유니크키 제거
refactor: 엔티티가 BaseEntity를 상속하도록 (#524) 
fix: BaseEntity 관련 마이그레이션 파일 수정 (#530) 
feat: 멘토 승격 api 구현 (#532) 
fix: 대학교 중복 오류 수정 (#510) 
refactor: 불필요한 로그 삭제 (#543)
fix: 운영환경 8081 포트 설정 추가 (#542) 
fix: dev환경 디비명 변경 (#546)
refactor: 불필요한 로그 삭제 (#547) 
refactor: 학기를 테이블로 관리하도록 변경 (#526) 
refactor: 모의지원 시 지원한 대학 정보 응답 추가 (#539)
@Gyuhyeok99 Gyuhyeok99 mentioned this pull request Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

버그 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 모의지원 결과 조회 시 중복 대학이 나오는 문제 해결

3 participants