Skip to content

Conversation

@Juhye0k
Copy link
Contributor

@Juhye0k Juhye0k commented Jul 28, 2025

What is this PR? 🔍

사용자가 자신이 지원한 채용공고 내역을 조회할 수 있는 기능을 추가했습니다.

Changes 💻

  • API 엔드포인트 추가: GET /jobPost/apply - 현재 로그인한 사용자의 모든 지원 내역 조회
  • JobApplication 엔티티 수정: Resume 관계 추가로 지원 시 사용한 이력서 정보 저장
  • 새로운 DTO 추가: JobPostApplicationDto - 지원 내역 응답을 위한 전용 DTO
  • Repository 쿼리 추가: JOIN FETCH를 활용한 N+1 문제 해결 및 성능 최적화
  • Swagger 문서화: API 명세 및 응답 스키마 추가

주요 기능 상세

1. 지원 내역 조회 API

  • 엔드포인트: GET /api/jobPost/apply
  • 인증 필요: @PreAuthorize("isAuthenticated()")
  • 응답 정보:
    • 채용공고 ID, 제목
    • 회사명, 주소
    • 지원일시, 지원 상태
    • 사용한 이력서명

2. 데이터베이스 변경사항

  • JobApplication 테이블에 resume_id 외래키 추가
  • 지원 시 어떤 이력서를 사용했는지 추적 가능

3. 성능 최적화

  • findAllByMemberIdWithJobPostAndCompany 쿼리에서 JOIN FETCH 사용

Summary by CodeRabbit

  • 신규 기능
    • 사용자가 자신의 이력서를 선택하여 채용 공고에 지원할 수 있는 기능이 추가되었습니다.
    • 사용자가 본인이 지원한 모든 채용 공고 목록을 조회할 수 있는 기능이 제공됩니다.
    • 지원 내역 조회 시, 지원한 공고의 제목, 회사명, 주소, 지원일, 지원 상태, 사용한 이력서 이름 등 상세 정보를 확인할 수 있습니다.
    • 채용 공고 지원 시 URL 경로가 간소화되었습니다.

@Juhye0k Juhye0k requested review from kon28289 and patulus July 28, 2025 12:16
@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

"""

Walkthrough

이번 변경사항은 사용자가 지원한 모든 구직 공고 목록을 조회하는 API와 DTO, 레포지토리 쿼리, 서비스 로직, 컨트롤러 엔드포인트를 추가하고, 구직 지원 시 이력서 정보를 연관시키도록 JobApplication 엔티티와 서비스 로직을 확장하는 내용입니다.

Changes

Cohort / File(s) Change Summary
API 및 컨트롤러 확장
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/api/JobPostApi.java, src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java
사용자가 지원한 모든 구직 공고를 조회하는 GET 엔드포인트와, 구직 지원 시 이력서와 함께 지원하는 POST 엔드포인트 추가. Swagger 문서 및 응답 DTO 적용.
엔티티 및 DTO 추가/확장
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/domain/JobApplication.java, src/main/java/kr/ac/kumoh/d138/JobForeigner/job/dto/response/JobPostApplicationDto.java
JobApplication 엔티티에 Resume 필드 및 생성자 추가. 지원 내역 응답용 JobPostApplicationDto 신규 생성.
레포지토리 및 서비스 확장
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/repository/JobApplicationRepository.java, src/main/java/kr/ac/kumoh/d138/JobForeigner/job/service/JobPostService.java
회원별 지원 내역을 JobPost, Company, Resume까지 조인하여 조회하는 커스텀 쿼리 및 서비스 메서드 추가. 지원 시 Resume 연관 저장 로직 추가.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Controller
    participant Service
    participant Repository
    participant ResumeRepo

    User->>Controller: GET /jobPost/apply (memberId)
    Controller->>Service: getAllApplyJobPost(memberId)
    Service->>Repository: findAllByMemberIdWithJobPostAndCompany(memberId)
    Repository-->>Service: List<JobApplication>
    Service->>Service: JobPostApplicationDto.of(...)
    Service-->>Controller: List<JobPostApplicationDto>
    Controller-->>User: ResponseBody<List<JobPostApplicationDto>>
Loading
sequenceDiagram
    participant User
    participant Controller
    participant Service
    participant JobPostRepo
    participant ResumeRepo
    participant JobApplicationRepo

    User->>Controller: POST /jobPost/{resumeId}/{jobPostId}/apply
    Controller->>Service: applyToJobPost(jobPostId, memberId, resumeId)
    Service->>JobPostRepo: findById(jobPostId)
    Service->>ResumeRepo: findById(resumeId)
    Service->>JobApplicationRepo: save(new JobApplication(..., resume))
    Service-->>Controller: void
    Controller-->>User: 성공 메시지
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement
"""

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0473291 and 3ddf451.

📒 Files selected for processing (1)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/application

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @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.

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 (2)
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java (2)

24-24: 와일드카드 import 사용이 코딩 가이드라인과 맞지 않을 수 있습니다.

NAVER Campus Hackday Java 코딩 컨벤션에 따르면 단일 클래스 import를 사용해야 하며, 와일드카드는 static import에서만 허용됩니다. 개별 annotation import를 사용하는 것을 고려해보세요.

다음과 같이 개별 import를 사용하는 것을 권장합니다:

-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;

104-104: RESTful한 엔드포인트 경로 구조 개선을 고려해보세요.

현재 경로 /jobPost/{resumeId}/{jobPostId}/apply에서 "jobPost"가 중복되고 RESTful 설계 원칙에 맞지 않습니다. 더 명확하고 일관성 있는 경로 구조를 고려해보세요.

다음과 같은 경로 구조를 권장합니다:

-@PostMapping("/jobPost/{resumeId}/{jobPostId}/apply")
+@PostMapping("/{jobPostId}/apply")

그리고 resumeId를 요청 본문이나 쿼리 파라미터로 전달하는 방법을 고려해보세요:

 public ResponseEntity<ResponseBody<String>> applyToJobPost(
         @PathVariable Long jobPostId,
         @CurrentMemberId Long memberId,
-        @PathVariable Long resumeId) {
+        @RequestParam Long resumeId) {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96e102e and 0473291.

📒 Files selected for processing (6)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/api/JobPostApi.java (3 hunks)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java (4 hunks)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/domain/JobApplication.java (2 hunks)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/dto/response/JobPostApplicationDto.java (1 hunks)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/repository/JobApplicationRepository.java (1 hunks)
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/service/JobPostService.java (4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.java

⚙️ CodeRabbit Configuration File

**/*.java: This project follows key rules from the NAVER Campus Hackday Java Coding Conventions (partial summary below; see full spec for details). * Indentation: use spaces (no tabs), tab width = 4 spaces. Files must end with Unix LF newline. * Line length: maximum 120 characters. * Imports: single-class imports only, allow wildcard for static imports, group imports with blank lines between sections. * Assignment operators (=, +=, -=, etc.): always have one space before and after; when breaking lines, the operator must start the next line (Binary expressions: operation sign on next line). * Lambda expressions: omit parentheses for a single parameter; surround -> with spaces (param -> expression); use braces and explicit return for multi-statement bodies; choose short, clear parameter names to keep intent visible. For the complete set of conventions and detailed examples, please refer to the full spec at https://naver.github.io/hackday-conventions-java/.

Files:

  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/repository/JobApplicationRepository.java
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/domain/JobApplication.java
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/service/JobPostService.java
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/api/JobPostApi.java
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/dto/response/JobPostApplicationDto.java
  • src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java
🔇 Additional comments (14)
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/repository/JobApplicationRepository.java (2)

5-6: 필요한 임포트 추가 완료.

Query와 Param 어노테이션을 위한 임포트가 적절히 추가되었습니다.


15-21: JOIN FETCH를 활용한 효율적인 쿼리 구현.

N+1 쿼리 문제를 해결하기 위해 JOIN FETCH를 사용하여 연관된 엔티티들(jobPost, company, resume)을 한 번에 조회하는 최적화된 구현입니다. 생성일자 기준 내림차순 정렬도 적절합니다.

src/main/java/kr/ac/kumoh/d138/JobForeigner/job/service/JobPostService.java (4)

11-11: 새로운 DTO 임포트 추가.

JobPostApplicationDto 임포트가 적절히 추가되었습니다.


20-21: Resume 관련 의존성 추가.

Resume 엔티티와 ResumeRepository 의존성이 적절히 추가되어 이력서 연관 기능을 지원합니다.

Also applies to: 46-46


178-179: 지원 시 이력서 연관 로직 추가.

Resume 엔티티를 조회하고 JobApplication 생성 시 연관시키는 로직이 올바르게 구현되었습니다. 예외 처리도 적절합니다.

Also applies to: 187-187


194-203: 지원 내역 조회 메서드 구현.

최적화된 레포지토리 쿼리를 사용하여 데이터를 조회하고 DTO로 변환하는 로직이 깔끔하게 구현되었습니다. 스트림 API를 적절히 활용했습니다.

src/main/java/kr/ac/kumoh/d138/JobForeigner/job/domain/JobApplication.java (2)

30-32: 이력서 연관 관계 추가.

Resume 엔티티와의 다대일 관계가 적절한 JPA 어노테이션과 함께 정의되었습니다. LAZY 페칭 전략과 조인 컬럼명도 적절합니다.


39-39: 생성자 업데이트.

Resume 파라미터를 포함하도록 생성자가 올바르게 업데이트되고 필드 초기화도 적절히 수행됩니다.

Also applies to: 42-42

src/main/java/kr/ac/kumoh/d138/JobForeigner/job/api/JobPostApi.java (2)

21-21: 필요한 임포트 추가.

새로운 DTO와 List 타입을 위한 임포트가 적절히 추가되었습니다.

Also applies to: 32-32


184-200: 지원 내역 조회 API 정의.

Swagger 문서화가 완벽하게 작성되었고, 메서드 시그니처도 적절합니다. 성공 응답과 에러 케이스가 명확히 정의되어 있습니다.

src/main/java/kr/ac/kumoh/d138/JobForeigner/job/dto/response/JobPostApplicationDto.java (3)

11-22: 적절한 DTO 필드 정의.

지원 내역 조회에 필요한 모든 필드가 적절한 타입으로 정의되었습니다. Lombok 어노테이션 사용도 적절합니다.


23-32: 빌더 패턴 생성자 구현.

모든 필드를 파라미터로 받는 빌더 생성자가 올바르게 구현되었습니다.


34-44: 정적 팩토리 메서드 구현.

JobPost와 JobApplication 엔티티로부터 DTO를 생성하는 정적 팩토리 메서드가 깔끔하게 구현되었습니다. 중첩된 프로퍼티 접근도 적절합니다.

src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java (1)

101-118: 새로운 채용공고 지원 기능이 잘 구현되었습니다.

두 개의 새로운 엔드포인트가 기존 컨트롤러 패턴과 일관성 있게 구현되었습니다:

  • 적절한 인증 처리 (@PreAuthorize("isAuthenticated()"))
  • 서비스 레이어로의 적절한 위임
  • 일관된 응답 형식 사용
  • 한국어 주석 사용

Copy link
Contributor

@kon28289 kon28289 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
Member

@patulus patulus left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

@Juhye0k Juhye0k merged commit 493c542 into dev Jul 28, 2025
3 checks passed
@kon28289 kon28289 deleted the feature/application branch July 29, 2025 12:35
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.

3 participants