[Feat] 공고 저장, 저장취소 API 구현#22
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughJob 공고의 텍스트·태그 매핑을 확장하고, 공고 저장·저장 취소 서비스와 REST API를 추가했습니다. ChangesJob 공고 데이터 매핑
공고 저장 기능
시간 감사 설정
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/java/com/leets7th/job_is_be/global/config/JpaConfig.java (1)
15-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
OffsetDateTime.now()가 시스템 기본 timezone을 사용합니다.배포 환경(예: UTC 컨테이너 vs KST 서버)에 따라 저장되는 offset이 달라질 수 있습니다. 한국 서비스라면 고정 offset 사용을 권장합니다.
♻️ 제안: 고정 timezone offset 사용
`@Bean` public DateTimeProvider offsetDateTimeProvider() { - return () -> Optional.of(OffsetDateTime.now()); + return () -> Optional.of(OffsetDateTime.now(ZoneOffset.ofHours(9))); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/leets7th/job_is_be/global/config/JpaConfig.java` around lines 15 - 17, Update the offsetDateTimeProvider bean to create the current OffsetDateTime with the service’s fixed Korean timezone offset instead of using the system default timezone; preserve the existing Optional-wrapped DateTimeProvider contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/leets7th/job_is_be/domain/job/controller/JobController.java`:
- Around line 17-35: JobController의 saveJob 및 unsaveJob에서 클라이언트가 전달한
`@RequestParam` userId를 신뢰하지 않도록 수정하세요. 인증 설정 전까지는 세션/토큰에서 검증된 사용자 ID를 사용하고 요청 값과
불일치하면 거부하거나, 검증 수단이 없으면 두 엔드포인트를 비활성화해 다른 사용자의 저장 상태를 변경할 수 없게 하세요.
In `@src/main/java/com/leets7th/job_is_be/domain/job/service/JobService.java`:
- Around line 26-41: Update JobService.saveJob to handle the database
unique-constraint race between existsByUserIdAndJobId and
savedJobRepository.save: catch DataIntegrityViolationException from the save
operation and translate it to GeneralException(ErrorStatus.JOB_ALREADY_SAVED),
preserving the existing pre-check and normal save behavior.
---
Nitpick comments:
In `@src/main/java/com/leets7th/job_is_be/global/config/JpaConfig.java`:
- Around line 15-17: Update the offsetDateTimeProvider bean to create the
current OffsetDateTime with the service’s fixed Korean timezone offset instead
of using the system default timezone; preserve the existing Optional-wrapped
DateTimeProvider contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4d2bf790-b046-4926-b404-c27c3f86bcb6
📒 Files selected for processing (14)
src/main/java/com/leets7th/job_is_be/domain/job/controller/JobController.javasrc/main/java/com/leets7th/job_is_be/domain/job/converter/JobPostingConverter.javasrc/main/java/com/leets7th/job_is_be/domain/job/entity/Job.javasrc/main/java/com/leets7th/job_is_be/domain/job/entity/SavedJob.javasrc/main/java/com/leets7th/job_is_be/domain/job/repository/SavedJobRepository.javasrc/main/java/com/leets7th/job_is_be/domain/job/service/JobService.javasrc/main/java/com/leets7th/job_is_be/domain/personality/entity/PersonalityTestAnswer.javasrc/main/java/com/leets7th/job_is_be/domain/user/entity/Resume.javasrc/main/java/com/leets7th/job_is_be/domain/user/entity/User.javasrc/main/java/com/leets7th/job_is_be/domain/user/entity/UserProfile.javasrc/main/java/com/leets7th/job_is_be/domain/user/entity/UserWithdrawal.javasrc/main/java/com/leets7th/job_is_be/global/config/JpaConfig.javasrc/main/java/com/leets7th/job_is_be/global/status/ErrorStatus.javasrc/main/java/com/leets7th/job_is_be/global/status/SuccessStatus.java
| // TODO 인증 세팅 후 @AuthenticationPrincipal로 교체 | ||
| @PostMapping("/{jobId}/save") | ||
| public ResponseEntity<ApiResponse<Void>> saveJob( | ||
| @PathVariable Long jobId, | ||
| @RequestParam Long userId | ||
| ) { | ||
| jobService.saveJob(userId, jobId); | ||
| return ApiResponse.success(SuccessStatus.JOB_SAVE_SUCCESS); | ||
| } | ||
|
|
||
| // TODO 인증 세팅 후 @AuthenticationPrincipal로 교체 | ||
| @DeleteMapping("/{jobId}/save") | ||
| public ResponseEntity<ApiResponse<Void>> unsaveJob( | ||
| @PathVariable Long jobId, | ||
| @RequestParam Long userId | ||
| ) { | ||
| jobService.unsaveJob(userId, jobId); | ||
| return ApiResponse.success(SuccessStatus.JOB_UNSAVE_SUCCESS); | ||
| } |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
userId를 @RequestParam으로 수신하면 IDOR 취약점이 발생합니다.
TODO로 인증 적용 후 @AuthenticationPrincipal로 교체 예정인 것은 확인했습니다. 하지만 현재 상태로 배포하면 임의의 userId를 쿼리 파라미터로 전달하여 다른 사용자의 공고 저장/취소를 조작할 수 있습니다. 인증 설정 전까지는 최소한 컨트롤러 단에서 세션/토큰 기반 사용자 검증을 수행하거나, 해당 엔드포인트를 비활성화하는 것을 권장합니다.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/com/leets7th/job_is_be/domain/job/controller/JobController.java`
around lines 17 - 35, JobController의 saveJob 및 unsaveJob에서 클라이언트가 전달한
`@RequestParam` userId를 신뢰하지 않도록 수정하세요. 인증 설정 전까지는 세션/토큰에서 검증된 사용자 ID를 사용하고 요청 값과
불일치하면 거부하거나, 검증 수단이 없으면 두 엔드포인트를 비활성화해 다른 사용자의 저장 상태를 변경할 수 없게 하세요.
#️⃣ 관련 이슈
closed #20
PR 유형
어떤 변경 사항이 있나요?
PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
🧩 작업 내용
📸 스크린샷(선택)
📣 To Reviewers
Summary by CodeRabbit