-
Notifications
You must be signed in to change notification settings - Fork 0
[CMAT-62] fix: Recruit 스키마 수정, 공고 조회 일부 로직 추가, 불필요 반환값 삭제 #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough이 PR은 빌드 구성 및 도메인 계층, 컨버터, DTO, 열거형, 쿼리 리포지토리에서 여러 수정이 이루어졌습니다. 빌드 파일에서 Hibernate 유틸리티 의존성이 제거되었고, Recruit 엔티티에서는 jobNames 필드가 삭제되고 hashtags 필드가 추가되었습니다. 컨버터와 DTO에서는 데이터 구조가 단순화되었으며, RecruitKeyword와 RecruitQueryRepositoryImpl에서는 키워드 관련 메서드 명 수정과 새로운 해시태그 필터 메서드가 추가되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant C as RecruitController
participant Q as RecruitQueryRepositoryImpl
participant R as RecruitKeyword
C->>Q: getRecruitData(필터 파라미터 전달)
Q->>R: getIncludeTitleKeywordList() & getIncludeHashtagKeywordList() 호출
R-->>Q: 키워드 리스트 반환
Q->>Q: 제목 및 해시태그 기준 필터 적용
Q-->>C: 필터링된 채용 데이터 반환
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (4)
src/main/java/UMC/career_mate/domain/recruit/enums/RecruitKeyword.java (2)
10-22: BACKEND enum의 키워드 목록이 개선될 수 있습니다.현재 BACKEND enum의 getIncludeHashtagKeywordList()가 null을 반환하고 있습니다. 백엔드 관련 일반적인 해시태그를 포함하는 것이 좋을 것 같습니다.
-public List<String> getIncludeHashtagKeywordList() { - return null; -} +public List<String> getIncludeHashtagKeywordList() { + return List.of("백엔드개발", "서버개발", "시스템개발"); +}
192-194: 추상 메소드들의 Javadoc 문서화가 필요합니다.각 추상 메소드의 목적과 반환값에 대한 설명이 있으면 좋겠습니다.
+/** + * 제목에 포함되어야 하는 키워드 목록을 반환합니다. + * @return 포함 키워드 목록 + */ public abstract List<String> getIncludeTitleKeywordList(); +/** + * 제목에서 제외되어야 하는 키워드 목록을 반환합니다. + * @return 제외 키워드 목록 + */ public abstract List<String> getExcludeTitleKeywordList(); +/** + * 해시태그에 포함되어야 하는 키워드 목록을 반환합니다. + * @return 해시태그 키워드 목록 + */ public abstract List<String> getIncludeHashtagKeywordList();src/main/java/UMC/career_mate/domain/recruit/repository/querydsl/RecruitQueryRepositoryImpl.java (2)
29-72: 메서드 변경사항이 잘 구현되었습니다!키워드 필터링 로직이 제목과 해시태그로 명확하게 구분되어 가독성이 향상되었습니다. 다만, 각 필터링 단계의 동작을 설명하는 메서드 레벨 문서화를 추가하면 좋을 것 같습니다.
다음과 같이 메서드 문서화를 추가하는 것을 고려해보세요:
+ /** + * 키워드, 학력, 경력, 정렬 조건에 따라 채용 공고를 검색합니다. + * + * @param recruitKeyword 제목 및 해시태그 검색 키워드 + * @param educationLevel 최소 학력 요구사항 + * @param careerYear 경력 연차 + * @param recruitSortType 정렬 기준 + * @param pageable 페이징 정보 + * @return 검색 조건에 맞는 채용 공고 목록 + */ @Override public Page<Recruit> findByKeywordWithBooleanBuilder(...)
74-96: 키워드 필터링 로직 최적화 제안제목 키워드 필터링 메서드들의 구현이 매우 유사합니다. 중복 코드를 제거하고 재사용성을 높이기 위해 공통 로직을 추출하는 것을 고려해보세요.
다음과 같이 리팩토링하는 것을 제안합니다:
+ private void buildKeywordCondition(List<String> keywords, BooleanBuilder targetBuilder, + StringPath field) { + for (String keyword : keywords) { + if (isEnglish(keyword)) { + targetBuilder.or(field.containsIgnoreCase(keyword)); + } else { + targetBuilder.or(field.contains(keyword)); + } + } + } + private void filterIncludeTitleKeywordList(List<String> includekeywordList, BooleanBuilder builder) { BooleanBuilder includeTitleBuilder = new BooleanBuilder(); - for (String keyword : includekeywordList) { - if (isEnglish(keyword)) { - includeTitleBuilder.or(recruit.title.containsIgnoreCase(keyword)); - } else { - includeTitleBuilder.or(recruit.title.contains(keyword)); - } - } + buildKeywordCondition(includekeywordList, includeTitleBuilder, recruit.title); builder.and(includeTitleBuilder); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
build.gradle(0 hunks)src/main/java/UMC/career_mate/domain/recruit/Recruit.java(1 hunks)src/main/java/UMC/career_mate/domain/recruit/controller/RecruitController.java(2 hunks)src/main/java/UMC/career_mate/domain/recruit/converter/RecruitConverter.java(1 hunks)src/main/java/UMC/career_mate/domain/recruit/dto/response/RecommendRecruitsDTO.java(1 hunks)src/main/java/UMC/career_mate/domain/recruit/enums/RecruitKeyword.java(2 hunks)src/main/java/UMC/career_mate/domain/recruit/repository/querydsl/RecruitQueryRepositoryImpl.java(2 hunks)
💤 Files with no reviewable changes (1)
- build.gradle
✅ Files skipped from review due to trivial changes (1)
- src/main/java/UMC/career_mate/domain/recruit/controller/RecruitController.java
🔇 Additional comments (3)
src/main/java/UMC/career_mate/domain/recruit/dto/response/RecommendRecruitsDTO.java (1)
13-19: DTO 구조가 개선되었습니다!불필요한 필드들이 제거되어 응답 구조가 더 간단하고 명확해졌습니다.
src/main/java/UMC/career_mate/domain/recruit/Recruit.java (1)
44-45: hashtags 필드의 형식을 명확히 정의해주세요.TEXT 타입으로 저장되는 hashtags의 구체적인 형식(구분자, 최대 길이 등)이 명시되어 있지 않습니다. 데이터 일관성을 위해 다음 사항들을 고려해주세요:
- 해시태그 구분자 정의
- 최대 길이 제한
- 유효성 검사 로직 추가
src/main/java/UMC/career_mate/domain/recruit/repository/querydsl/RecruitQueryRepositoryImpl.java (1)
98-110: 해시태그 필터링 엣지 케이스 처리 필요해시태그 필터링 구현이 잘 되어있지만, 몇 가지 엣지 케이스에 대한 처리가 필요해 보입니다.
다음 사항들을 확인해주세요:
- 해시태그에 특수문자가 포함된 경우의 처리
- 대소문자 혼합 해시태그 처리의 일관성
- 빈 문자열이나 공백만 있는 해시태그 처리
아래 스크립트로 현재 구현의 동작을 검증할 수 있습니다:
❌ Verification inconclusive
🏁 Script executed:
#!/bin/bash # 해시태그 필터링 관련 코드 검색 rg -A 5 "hashtags\." .Length of output: 1078
해시태그 필터링 엣지 케이스에 대한 추가 검증 필요
현재 해시태그 필터링 로직은 입력 문자열의 언어에 따라
containsIgnoreCase와contains를 사용하는 방식으로 구현되어 있습니다. 다만, 아래와 같은 엣지 케이스에 대한 처리는 명시적으로 고려되지 않은 것으로 보입니다.
- 해시태그에 특수문자가 포함된 경우에 대한 처리
- 대소문자 혼합 해시태그에 대해 일관성 있는 처리 여부 (특히 영어와 비영어의 구분 기준 확인 필요)
- 빈 문자열 또는 공백만 있는 해시태그에 대한 처리
이 부분들에 대해 추가적인 테스트나 검증 로직 도입을 고려해 주세요.
| .employmentName(job.position().jobType().name()) | ||
| .salaryName(job.salary().name()) | ||
| .jobNames(Arrays.asList(job.position().jobCode().name())) | ||
| .hashtags(job.position().jobCode().name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
hashtags 할당 전 유효성 검사가 필요합니다.
직접 할당하기 전에 다음 사항들을 검증하는 것이 좋습니다:
- null 체크
- 특수문자 처리
- 최대 길이 검증
예시 코드:
-.hashtags(job.position().jobCode().name())
+.hashtags(validateAndFormatHashtags(job.position().jobCode().name()))
+private static String validateAndFormatHashtags(String hashtags) {
+ if (hashtags == null) return "";
+ return hashtags.trim().replaceAll("[^\\w\\s,]", "");
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .hashtags(job.position().jobCode().name()) | |
| .hashtags(validateAndFormatHashtags(job.position().jobCode().name())) | |
| // ... other code in the file ... | |
| private static String validateAndFormatHashtags(String hashtags) { | |
| if (hashtags == null) return ""; | |
| return hashtags.trim().replaceAll("[^\\w\\s,]", ""); | |
| } |
kyoooooong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고 많으셨습니다 👍👍
#️⃣ 요약 설명
📝 작업 내용
// 핵심 코드를 붙여넣기 해주세요코드에 대한 간단한 설명 부탁드립니다.
동작 확인
💬 리뷰 요구사항(선택)
Summary by CodeRabbit