[Feat] Job 도메인 구현 - #24
Conversation
|
Warning Review limit reached
More reviews will be available in 15 minutes and 9 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough공고 도메인의 엔티티, 상태/카테고리 enum, 요청·응답 DTO, 저장소, 서비스, 컨트롤러, 응답 계약과 예외 처리가 추가되었습니다. 애플리케이션 설정은 날짜 직렬화와 Hibernate 스키마 동작을 바꾸고, ChangesJob 도메인 구현
정적 리소스 ignore
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 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/ilson/spotwork/domain/job/controller/JobController.java`:
- Around line 28-33: The register endpoint in JobController returns mismatched
HTTP and body statuses because `@ResponseStatus`(HttpStatus.CREATED) sends 201
while ApiResponse.success(response) hardcodes a 200 code. Update the register
method and the ApiResponse success path it uses so the response body code
matches the CREATED status, or switch the endpoint to a consistent success
status if this is meant to be a normal 200 response. Use the register method,
JobController, and ApiResponse.success as the key points to align the contract.
- Around line 27-33: The JobController.register flow currently allows any
authenticated user to create a job, so add an explicit EMPLOYER-only
authorization check. Apply `@PreAuthorize`("hasRole('EMPLOYER')") on
JobController.register or enforce the same Role validation inside
JobService.register before creating the Job, using the existing
CustomUserDetails, jobService.register, and employer lookup paths to locate the
right spot.
- Around line 39-42: `JobController`의 `getList`와 `getMyJobs`에서 `page`/`size`가 음수
또는 0 이하로 들어와 `PageRequest.of()`에서 500이 나는 문제입니다. 컨트롤러 클래스에 `@Validated`를 추가하고, 두
메서드의 `page` 파라미터에는 `@Min(0)`, `size` 파라미터에는 `@Positive`를 붙여 입력 단계에서 400으로 검증되게
수정하세요. `JobController`, `getList`, `getMyJobs` 식별자를 기준으로 반영하면 됩니다.
In `@src/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.java`:
- Around line 40-44: `JobCreateRequestDto`의 `latitude`와 `longitude`는 현재
`@NotNull`만 적용되어 잘못된 좌표값이 들어올 수 있으므로 범위 검증을 추가하세요. `latitude`에는 위도 허용 범위가 적용되도록,
`longitude`에는 경도 허용 범위가 적용되도록 `DecimalMin`/`DecimalMax` 제약을 함께 선언해
`JobCreateRequestDto`의 좌표 필드가 유효한 값만 통과하도록 수정해 주세요.
- Around line 28-32: `JobCreateRequestDto`의 `startTime`/`endTime`는 개별 null 검증만
있어서 역전된 근무 시간이 통과하므로, `isValidTimeRange()` 같은 검증 메서드를 추가해
`endTime.isAfter(startTime)`만 허용하도록 처리하세요. `startTime` 또는 `endTime`이 null인 경우에는
`@NotNull`이 먼저 처리하므로 이 검증은 통과하도록 null-safe하게 작성하고, 같은 로직을
`JobUpdateRequestDto`에도 동일하게 적용하세요.
In `@src/main/java/com/ilson/spotwork/domain/job/dto/JobUpdateRequestDto.java`:
- Around line 22-23: The update request DTO allows past work dates because
JobUpdateRequestDto only has `@NotNull` on workDate while JobService.update(...)
passes request.getWorkDate() directly into Job.updateInfo(...). Add the same
present-or-future validation used in the create DTO to
JobUpdateRequestDto.workDate so update requests cannot move an open job back to
a past date. Keep the fix localized to JobUpdateRequestDto and ensure the
validation annotation matches the create flow.
In `@src/main/java/com/ilson/spotwork/domain/job/entity/Job.java`:
- Around line 63-71: Job.updateInfo currently updates address without refreshing
latitude and longitude, so the entity can end up with a new address and stale
coordinates. Update the Job.updateInfo flow (and the JobController.update path
that calls it) so address changes either also accept and assign new
latitude/longitude values, or remove address from the editable fields if
coordinates are not meant to change. Make sure the Job entity stays consistent
whenever updateInfo is used.
In `@src/main/java/com/ilson/spotwork/domain/job/repository/JobRepository.java`:
- Around line 14-20: The list queries in JobRepository are triggering N+1
because JobResponseDto.from() reads job.getEmployer() from a LAZY `@ManyToOne`
association. Update the repository methods findByStatus and findByEmployerId to
eagerly fetch employer with `@EntityGraph` so Job and its Employer are loaded
together in one query. Keep the method names intact and apply the fetch plan
directly on the repository methods that back the job list pages.
In `@src/main/java/com/ilson/spotwork/domain/job/service/JobService.java`:
- Around line 30-50: The JobService.register method currently only checks that
the user exists, but it does not enforce that the caller is an EMPLOYER before
saving the Job. Add an explicit role validation after loading the User (using
the employer variable or equivalent) and before jobRepository.save, and throw
the appropriate CustomException if the role is not EMPLOYER. Keep the check
localized in JobService.register so only employer users can create jobs.
In `@src/main/resources/application.yml`:
- Around line 10-12: The default JPA Hibernate setting in application.yml
currently uses ddl-auto: update, which should not be applied globally. Update
the configuration so the base application.yml uses validate or none, and move
any schema-auto-update behavior into a profile-specific file such as
application-dev.yml or application-local.yml. Make sure the change is applied in
the jpa.hibernate.ddl-auto setting and that only non-production profiles enable
automatic schema updates.
🪄 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 Plus
Run ID: 21d9b3df-7a8d-490d-aed1-f067cd1d45fc
📒 Files selected for processing (12)
.gitignoregradlewsrc/main/java/com/ilson/spotwork/domain/job/controller/JobController.javasrc/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.javasrc/main/java/com/ilson/spotwork/domain/job/dto/JobResponseDto.javasrc/main/java/com/ilson/spotwork/domain/job/dto/JobUpdateRequestDto.javasrc/main/java/com/ilson/spotwork/domain/job/entity/Job.javasrc/main/java/com/ilson/spotwork/domain/job/entity/JobCategory.javasrc/main/java/com/ilson/spotwork/domain/job/entity/JobStatus.javasrc/main/java/com/ilson/spotwork/domain/job/repository/JobRepository.javasrc/main/java/com/ilson/spotwork/domain/job/service/JobService.javasrc/main/resources/application.yml
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/ilson/spotwork/common/response/ApiResponse.java`:
- Around line 29-34: The new ApiResponse.error overloads removed the
integer-status variant, but SecurityConfig still calls ApiResponse.error(401,
"인증이 필요합니다."); update the SecurityConfig entry point that builds the
unauthorized response to use the remaining ApiResponse.error(String) or
ApiResponse.error(String, T) signature, or restore a temporary
ApiResponse.error(int, String) compatibility overload if needed so existing
callers keep compiling.
🪄 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 Plus
Run ID: 5e1a5a57-1c5a-4afd-a35e-ccc6aadbec50
📒 Files selected for processing (8)
src/main/java/com/ilson/spotwork/common/exception/GlobalExceptionHandler.javasrc/main/java/com/ilson/spotwork/common/response/ApiResponse.javasrc/main/java/com/ilson/spotwork/domain/job/controller/JobController.javasrc/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.javasrc/main/java/com/ilson/spotwork/domain/job/dto/JobUpdateRequestDto.javasrc/main/java/com/ilson/spotwork/domain/job/entity/Job.javasrc/main/java/com/ilson/spotwork/domain/job/service/JobService.javasrc/main/resources/application.yml
🚧 Files skipped from review as they are similar to previous changes (4)
- src/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.java
- src/main/java/com/ilson/spotwork/domain/job/entity/Job.java
- src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
- src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
관련 이슈
closes #21
구현 내용
변경 사항
체크리스트
Summary by CodeRabbit