Skip to content

Conversation

@momuzzi
Copy link
Member

@momuzzi momuzzi commented Feb 12, 2025

#️⃣ 요약 설명

  1. Recruit 엔티티의 필드명(jobNames -> hashtags)과 데이터 타입(Json -> TEXT)을 수정했습니다.
  2. 채용 공고 조회 쿼리에 hashtags 값에 대한 조건도 추가했습니다.
  3. 값 정렬과 조회가 잘 되는지 확인용으로 반환했던 필드들을 삭제했습니다.

📝 작업 내용

코드의 흐름이나 중요한 부분을 작성해주세요.

// 핵심 코드를 붙여넣기 해주세요

코드에 대한 간단한 설명 부탁드립니다.

동작 확인

기능을 실행했을 때 정상 동작하는지 여부를 확인하고 사진을 올려주세요

ex) 테스트 코드 작성후 성공 사진
ex) swagger 사진

💬 리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

Summary by CodeRabbit

  • Chores
    • 불필요한 라이브러리 의존성을 제거하여 빌드 구성을 정리했습니다.
  • Refactor
    • 채용 정보의 직무 키워드가 기존 목록에서 단일 해시태그 문자열로 변경되었습니다.
    • 추천 채용 목록 관련 데이터 구성이 단순화되어 일부 세부 정보가 제거되었습니다.
  • New Features
    • 키워드 검색 기능이 향상되어, 타이틀 및 해시태그 기반의 필터링이 도입되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2025

Walkthrough

이 PR은 빌드 구성 및 도메인 계층, 컨버터, DTO, 열거형, 쿼리 리포지토리에서 여러 수정이 이루어졌습니다. 빌드 파일에서 Hibernate 유틸리티 의존성이 제거되었고, Recruit 엔티티에서는 jobNames 필드가 삭제되고 hashtags 필드가 추가되었습니다. 컨버터와 DTO에서는 데이터 구조가 단순화되었으며, RecruitKeyword와 RecruitQueryRepositoryImpl에서는 키워드 관련 메서드 명 수정과 새로운 해시태그 필터 메서드가 추가되었습니다.

Changes

파일(들) 변경 요약
build.gradle dependencies 블록에서 io.hypersistence:hypersistence-utils-hibernate-62:3.7.0 의존성 제거
src/main/java/UMC/.../Recruit.java jobNames 필드 제거, hashtags 필드 추가
src/main/java/UMC/.../RecruitController.java 주석 및 메서드 서명의 포매팅 수정 (실제 기능 변경 없음)
src/main/java/UMC/.../converter/RecruitConverter.java
src/main/java/UMC/.../dto/response/RecommendRecruitsDTO.java
Recruit 변환 시, 리스트에서 단일 문자열 기반의 해시태그 사용 및 RecruitThumbNailInfoDTO 내 여러 필드 제거
src/main/java/UMC/.../enums/RecruitKeyword.java
src/main/java/UMC/.../repository/querydsl/RecruitQueryRepositoryImpl.java
키워드 처리 메서드 이름 변경 (getInclude/ExcludeKeywordList → getInclude/ExcludeTitleKeywordList) 및 새로운 해시태그 관련 메서드 추가

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: 필터링된 채용 데이터 반환
Loading

Possibly related PRs

Suggested labels

fix

Suggested reviewers

  • jpark0506
  • KSLEE19
  • jjeongdong
  • kyoooooong

Poem

나는 작은 토끼, 코드를 뛰어넘네
빌드 파일에서 불필요한 의존성 멀리 보내고,
Recruit엔 jobNames는 사라지고 hashtags 반겨
컨버터와 열거형도 새 이름으로 노래해
데이터 간결해진 이 변화, 깔끔한 코드에 뿌듯함 😄
코드 숲 속을 누비며 즐겁게 춤추리라!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3e9f1c7 and 8464af4.

📒 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: 해시태그 필터링 엣지 케이스 처리 필요

해시태그 필터링 구현이 잘 되어있지만, 몇 가지 엣지 케이스에 대한 처리가 필요해 보입니다.

다음 사항들을 확인해주세요:

  1. 해시태그에 특수문자가 포함된 경우의 처리
  2. 대소문자 혼합 해시태그 처리의 일관성
  3. 빈 문자열이나 공백만 있는 해시태그 처리

아래 스크립트로 현재 구현의 동작을 검증할 수 있습니다:

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# 해시태그 필터링 관련 코드 검색
rg -A 5 "hashtags\." .

Length of output: 1078


해시태그 필터링 엣지 케이스에 대한 추가 검증 필요

현재 해시태그 필터링 로직은 입력 문자열의 언어에 따라 containsIgnoreCasecontains를 사용하는 방식으로 구현되어 있습니다. 다만, 아래와 같은 엣지 케이스에 대한 처리는 명시적으로 고려되지 않은 것으로 보입니다.

  • 해시태그에 특수문자가 포함된 경우에 대한 처리
  • 대소문자 혼합 해시태그에 대해 일관성 있는 처리 여부 (특히 영어와 비영어의 구분 기준 확인 필요)
  • 빈 문자열 또는 공백만 있는 해시태그에 대한 처리

이 부분들에 대해 추가적인 테스트나 검증 로직 도입을 고려해 주세요.

.employmentName(job.position().jobType().name())
.salaryName(job.salary().name())
.jobNames(Arrays.asList(job.position().jobCode().name()))
.hashtags(job.position().jobCode().name())
Copy link

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.

Suggested change
.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,]", "");
}

Copy link
Contributor

@kyoooooong kyoooooong left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다 👍👍

@momuzzi momuzzi merged commit e7ed1f5 into develop Feb 13, 2025
1 check passed
@momuzzi momuzzi deleted the feature/CMAT-62 branch February 13, 2025 04:41
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.

4 participants