Skip to content

Conversation

@kyoooooong
Copy link
Contributor

@kyoooooong kyoooooong commented Feb 11, 2025

#️⃣ 요약 설명

📝 작업 내용

  1. 이전에 사용자가 스크랩한 모든 컨텐츠를 조회하는 것에서, 스크랩한 컨텐츠들 중 현재 직무 정보와 같은 컨텐츠들만 조회되도록 수정하였습니다.

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

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

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

동작 확인

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

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

💬 리뷰 요구사항(선택)

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

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

Summary by CodeRabbit

  • New Features
    • 멤버 관련 채용 ID를 기준으로 콘텐츠 스크랩 조회 기능이 개선되었습니다. 페이지네이션을 통해 결과를 쉽게 확인할 수 있습니다.
    • 지원 직무 정보 누락 시 명확한 오류 메시지가 제공되어 보다 안정적인 사용자 경험을 보장합니다.

@kyoooooong kyoooooong added the fix 버그/에러 수정 label Feb 11, 2025
@kyoooooong kyoooooong self-assigned this Feb 11, 2025
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2025

Walkthrough

이번 PR은 ContentScrapRepositoryContentScrapService에 변경을 도입합니다. 저장소 인터페이스에 멤버와 job ID를 이용해 콘텐츠 스크랩을 조회하는 새로운 메서드 findByMemberAndJobId가 추가되었습니다. 서비스 로직에서는 job ID의 유효성을 검증하고, 해당 필터 기준으로 데이터를 조회하도록 수정되었습니다.

Changes

파일 경로 변경 요약
src/main/java/UMC/.../repository/ContentScrapRepository.java JPQL을 활용해 findByMemberAndJobId 메서드 추가 (멤버와 job ID 기준 조회, 페이지네이션 지원)
src/main/java/UMC/.../service/ContentScrapService.java getScrapContents 메서드 수정: job ID 검증 추가 및 저장소 호출 변경 (job ID 기반 필터링, 예외 발생 처리 포함)

Sequence Diagram(s)

sequenceDiagram
    participant Client as 클라이언트
    participant Service as ContentScrapService
    participant Repository as ContentScrapRepository
    participant DB as 데이터베이스

    Client->>Service: getScrapContents(member, page, size) 호출
    Service->>Service: jobId 검증 (null인 경우 예외 발생)
    Service->>Repository: findByMemberAndJobId(member, jobId, pageable) 호출
    Repository->>DB: JPQL 쿼리 실행
    DB-->>Repository: Page<ContentScrap> 결과 반환
    Repository-->>Service: 결과 전달
    Service-->>Client: 변환된 ContentScrapResponseDTO 반환
Loading

Possibly related PRs

Suggested reviewers

  • jpark0506
  • veronees
  • KSLEE19
  • jjeongdong

Poem

🐰 코드를 뛰노는 나의 발,
새로운 메서드 한 줄에 피어난다.
데이터 흐름을 따라 춤추며,
스크랩은 jobId와 함께 노래해.
예외도 깔끔히 처리되어,
코드 숲 속 행복한 내 발자취!
오늘도 달콤한 코드 모험! 🥕


📜 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 04f5925 and e48cb67.

📒 Files selected for processing (2)
  • src/main/java/UMC/career_mate/domain/contentScrap/repository/ContentScrapRepository.java (1 hunks)
  • src/main/java/UMC/career_mate/domain/contentScrap/service/ContentScrapService.java (1 hunks)
🔇 Additional comments (3)
src/main/java/UMC/career_mate/domain/contentScrap/repository/ContentScrapRepository.java (1)

23-25: JOIN FETCH를 사용한 최적화가 잘 되어있습니다!

N+1 문제를 방지하기 위해 JOIN FETCH를 사용한 것이 좋습니다. 회원과 직무 ID로 필터링하는 로직도 정확하게 구현되어 있습니다.

src/main/java/UMC/career_mate/domain/contentScrap/service/ContentScrapService.java (2)

56-60: 직무 ID null 체크 로직이 적절합니다.

사용자의 직무 ID가 없는 경우에 대한 예외 처리가 명확하게 구현되어 있습니다.


64-65: 현재 직무 기반 필터링이 잘 구현되어 있습니다.

회원이 스크랩한 콘텐츠 중 현재 직무와 일치하는 것만 조회하도록 하는 요구사항이 정확하게 구현되어 있습니다. 코드의 가독성을 위해 주석도 잘 작성되어 있습니다.

✨ 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
Contributor

@jpark0506 jpark0506 left a comment

Choose a reason for hiding this comment

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

LGTM~

Comment on lines +58 to +60
if (jobId == null) {
throw new GeneralException(CommonErrorCode.NOT_FOUND_BY_JOB_ID);
}
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
Member

Choose a reason for hiding this comment

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

Job에 대해 null 체크를 하는건 어떨까요?
Job이 있으면 jobId가 있는게 보장되서, Job이 있는데 jobId가 없는 경우는 없을거라
.getId()에서 널포인트 예외가 터질 수 있을 것 같아여

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Job에 대해 null 체크를 하는건 어떨까요? Job이 있으면 jobId가 있는게 보장되서, Job이 있는데 jobId가 없는 경우는 없을거라 .getId()에서 널포인트 예외가 터질 수 있을 것 같아여

오 넵 이거 한번 수정해둘게요!!

Copy link
Member

@momuzzi momuzzi left a comment

Choose a reason for hiding this comment

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

LGTM~ 의견 하나 남겨뒀습니다ㅏ

Comment on lines +58 to +60
if (jobId == null) {
throw new GeneralException(CommonErrorCode.NOT_FOUND_BY_JOB_ID);
}
Copy link
Member

Choose a reason for hiding this comment

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

Job에 대해 null 체크를 하는건 어떨까요?
Job이 있으면 jobId가 있는게 보장되서, Job이 있는데 jobId가 없는 경우는 없을거라
.getId()에서 널포인트 예외가 터질 수 있을 것 같아여

@kyoooooong kyoooooong merged commit 3e9f1c7 into develop Feb 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 버그/에러 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants