Skip to content

[Feat] Job 도메인 구현 - #24

Merged
kosy00 merged 16 commits into
developfrom
feat/21-job-api
Jun 27, 2026
Merged

[Feat] Job 도메인 구현#24
kosy00 merged 16 commits into
developfrom
feat/21-job-api

Conversation

@kosy00

@kosy00 kosy00 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

관련 이슈

closes #21

구현 내용

  • Job 엔티티 + 위경도 설계
  • 공고 CRUD API
  • 공고 목록 + 페이지네이션

변경 사항

  • Job 엔티티 작성
  • JobStatus enum 정의
  • 공고 등록 API (EMPLOYER만 가능)
  • 공고 수정 API (본인 공고만)
  • 공고 삭제 API (본인 공고만)
  • 공고 상세 조회 API (인증 불필요)
  • 공고 목록 조회 API (Pageable 적용)

체크리스트

  • 코드 구현 완료
  • 동작 확인
  • 불필요한 코드/주석 제거

Summary by CodeRabbit

  • New Features
    • 공고 등록/수정/삭제, 공고 목록/상세 조회, 내 공고 조회, 공고 마감 기능을 추가했습니다.
    • 제목·업종·시급·근무일시·인원·주소·위치 및 고용주 정보, 열림/마감 상태를 제공하며 페이지네이션/정렬이 적용됩니다.
    • 좌표와 근무 시간의 유효성도 함께 검증됩니다.
  • Bug Fixes
    • 날짜/응답 포맷을 개선하고, 실행 시 DB 스키마는 검증 모드로 동작하도록 조정했습니다.
    • 입력 검증 오류 응답이 더 일관되게 제공됩니다.
  • Chores
    • 정적 리소스는 Git에 포함되지 않도록 설정했습니다.

@kosy00 kosy00 self-assigned this Jun 26, 2026
@kosy00 kosy00 added the feat 새 기능 label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kosy00, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d41783ac-0fc7-4e1d-809e-2fbf4f80ad4e

📥 Commits

Reviewing files that changed from the base of the PR and between 1430e6d and 2a28f2b.

📒 Files selected for processing (2)
  • src/main/java/com/ilson/spotwork/infra/security/SecurityConfig.java
  • src/test/resources/application.yml
📝 Walkthrough

Walkthrough

공고 도메인의 엔티티, 상태/카테고리 enum, 요청·응답 DTO, 저장소, 서비스, 컨트롤러, 응답 계약과 예외 처리가 추가되었습니다. 애플리케이션 설정은 날짜 직렬화와 Hibernate 스키마 동작을 바꾸고, .gitignore는 정적 리소스 경로를 제외합니다.

Changes

Job 도메인 구현

Layer / File(s) Summary
도메인 타입과 DTO
src/main/java/com/ilson/spotwork/domain/job/entity/*, src/main/java/com/ilson/spotwork/domain/job/dto/*
Job 카테고리와 상태, Job 엔티티 매핑, 생성·수정 요청 DTO, 응답 DTO와 from(Job) 변환, close()updateInfo(...)가 추가됩니다.
저장소와 설정
src/main/java/com/ilson/spotwork/domain/job/repository/JobRepository.java, src/main/resources/application.yml
상태·날짜·고용주 기준 조회 메서드가 추가되고, 날짜 직렬화와 Hibernate ddl-auto 설정이 변경됩니다.
응답 계약과 예외 처리
src/main/java/com/ilson/spotwork/common/response/ApiResponse.java, src/main/java/com/ilson/spotwork/common/exception/GlobalExceptionHandler.java
ApiResponse가 code 없는 메시지/데이터 응답으로 바뀌고, 전역 예외 처리기가 새 응답 형식과 ConstraintViolationException 처리를 사용하도록 변경됩니다.
서비스 오케스트레이션
src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
공고 등록, 공개 목록, 상세 조회, 소유자 검증 수정/삭제, 내 공고 목록, 마감 흐름이 구현됩니다.
REST 엔드포인트
src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
/api/jobs의 등록, 목록, 상세, 수정, 삭제, /me 조회 엔드포인트가 ApiResponse로 감싸져 노출됩니다.

정적 리소스 ignore

Layer / File(s) Summary
정적 리소스 제외
.gitignore
src/main/resources/static/ 경로가 Git 무시 대상에 추가됩니다.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • kosy00/ilson#6: GlobalExceptionHandlerApiResponse의 에러 응답 생성 방식이 같이 변경되어, 같은 응답 계약 영역을 직접 다룹니다.

Poem

깡총, 새 공고가 들판에 피었네 🐰
OPEN과 CLOSED가 달빛 아래 반짝이네
페이지는 살짝 넘기고
내 토끼발로 마감도 톡!
당근 한 입, 코드도 통통 튀네

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Job CRUD와 페이지네이션은 구현됐지만 #21의 Redis 캐싱 요구가 반영되지 않았습니다. Redis 캐싱을 추가하거나, 미구현 사유와 대체 방안을 #21 설명에 명시하세요.
Out of Scope Changes check ⚠️ Warning Job 도메인과 직접 관련 없는 .gitignore, 전역 응답/예외 처리, 애플리케이션 설정 변경이 포함됩니다. Job 기능에 필요한 변경만 남기고 .gitignore, ApiResponse, GlobalExceptionHandler, application.yml 수정은 분리하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 73.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 Job 도메인 구현이라는 핵심 변경을 짧고 명확하게 나타냅니다.
Description check ✅ Passed 필수 섹션인 관련 이슈, 구현 내용, 변경 사항, 체크리스트를 모두 포함합니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/21-job-api

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between bf5d761 and be07faa.

📒 Files selected for processing (12)
  • .gitignore
  • gradlew
  • src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobResponseDto.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobUpdateRequestDto.java
  • src/main/java/com/ilson/spotwork/domain/job/entity/Job.java
  • src/main/java/com/ilson/spotwork/domain/job/entity/JobCategory.java
  • src/main/java/com/ilson/spotwork/domain/job/entity/JobStatus.java
  • src/main/java/com/ilson/spotwork/domain/job/repository/JobRepository.java
  • src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
  • src/main/resources/application.yml

Comment thread src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java Outdated
Comment thread src/main/java/com/ilson/spotwork/domain/job/entity/Job.java Outdated
Comment thread src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
Comment thread src/main/resources/application.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between be07faa and 1430e6d.

📒 Files selected for processing (8)
  • src/main/java/com/ilson/spotwork/common/exception/GlobalExceptionHandler.java
  • src/main/java/com/ilson/spotwork/common/response/ApiResponse.java
  • src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobCreateRequestDto.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobUpdateRequestDto.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/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

Comment thread src/main/java/com/ilson/spotwork/common/response/ApiResponse.java
@kosy00
kosy00 merged commit 22ae382 into develop Jun 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 새 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Job 도메인 구현

1 participant