-
Notifications
You must be signed in to change notification settings - Fork 0
feat : 지원 내역 조회 기능 추가 #108
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이번 변경사항은 사용자가 지원한 모든 구직 공고 목록을 조회하는 API와 DTO, 레포지토리 쿼리, 서비스 로직, 컨트롤러 엔드포인트를 추가하고, 구직 지원 시 이력서 정보를 연관시키도록 JobApplication 엔티티와 서비스 로직을 확장하는 내용입니다. Changes
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>>
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: 성공 메시지
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
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 (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
📒 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 explicitreturnfor 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 athttps://naver.github.io/hackday-conventions-java/.
Files:
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/repository/JobApplicationRepository.javasrc/main/java/kr/ac/kumoh/d138/JobForeigner/job/domain/JobApplication.javasrc/main/java/kr/ac/kumoh/d138/JobForeigner/job/service/JobPostService.javasrc/main/java/kr/ac/kumoh/d138/JobForeigner/job/api/JobPostApi.javasrc/main/java/kr/ac/kumoh/d138/JobForeigner/job/dto/response/JobPostApplicationDto.javasrc/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()"))- 서비스 레이어로의 적절한 위임
- 일관된 응답 형식 사용
- 한국어 주석 사용
src/main/java/kr/ac/kumoh/d138/JobForeigner/job/controller/JobPostController.java
Outdated
Show resolved
Hide resolved
kon28289
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.
수고하셨습니다!
patulus
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.
고생하셨습니다!!
What is this PR? 🔍
사용자가 자신이 지원한 채용공고 내역을 조회할 수 있는 기능을 추가했습니다.
Changes 💻
GET /jobPost/apply- 현재 로그인한 사용자의 모든 지원 내역 조회JobPostApplicationDto- 지원 내역 응답을 위한 전용 DTO주요 기능 상세
1. 지원 내역 조회 API
GET /api/jobPost/apply@PreAuthorize("isAuthenticated()")2. 데이터베이스 변경사항
JobApplication테이블에resume_id외래키 추가3. 성능 최적화
findAllByMemberIdWithJobPostAndCompany쿼리에서 JOIN FETCH 사용Summary by CodeRabbit