Skip to content

[Feat] 공고 검색 및 필터링 로직 구현 - #26

Merged
kosy00 merged 7 commits into
developfrom
feat/22-job-search
Jul 3, 2026
Merged

[Feat] 공고 검색 및 필터링 로직 구현#26
kosy00 merged 7 commits into
developfrom
feat/22-job-search

Conversation

@kosy00

@kosy00 kosy00 commented Jun 28, 2026

Copy link
Copy Markdown
Owner

관련 이슈

closes #22

구현 내용

  • search() 추가 및 getList() 대체하고 로직 수정

변경 사항

  • QueryDsl 및 Specification 중 전자 선택하여 도입함
  • JobSearchCondition,JobSummaryResponse, JobQueryRepository, JobQueryRepositoryImpl 추가
  • QuerydslConfig — JPAQueryFactory Bean 등록
  • GET /api/jobs/search — 검색 엔드포인트

체크리스트

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

Summary by CodeRabbit

  • 새 기능

    • 채용 공고 목록에서 카테고리, 근무일, 시급 범위로 검색할 수 있게 되었습니다.
    • 공고 목록이 요약 정보와 페이지 단위로 제공됩니다.
  • 버그 수정

    • 잘못된 입력값이 들어오면 더 명확한 400 응답 메시지를 반환합니다.
    • 시급 범위 입력 검증이 강화되어 유효하지 않은 조건을 미리 처리합니다.
  • 보안

    • 공고 등록은 지정된 권한을 가진 사용자만 사용할 수 있도록 제한되었습니다.

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

coderabbitai Bot commented Jun 28, 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 39 minutes and 17 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: 7edfe369-e36a-4a24-a891-6bb9227efb16

📥 Commits

Reviewing files that changed from the base of the PR and between 610f9df and 2c9504c.

📒 Files selected for processing (3)
  • src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
  • src/main/java/com/ilson/spotwork/domain/job/repository/JobQueryRepositoryImpl.java
  • src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
📝 Walkthrough

Walkthrough

QueryDSL 의존성 및 QuerydslConfig 설정을 추가하고, 공고 검색 조건 DTO(JobSearchCondition)와 응답 DTO(JobSummaryResponse)를 신규 생성했습니다. JobQueryRepository 인터페이스와 JobQueryRepositoryImpl 구현체를 통해 OPEN 상태·카테고리·근무일·시급 범위 필터 기반 페이징 검색을 구현하고, 기존 getList 엔드포인트를 search로 교체했습니다.

Changes

QueryDSL 기반 공고 검색/필터링

Layer / File(s) Summary
QueryDSL 의존성 및 설정
build.gradle, src/main/java/com/ilson/spotwork/common/config/QuerydslConfig.java
querydsl-jpa, querydsl-apt, Jakarta API 의존성을 추가하고 JPAQueryFactory를 Bean으로 등록하는 QuerydslConfig 설정 클래스를 추가.
검색 조건 및 응답 DTO
src/main/java/com/ilson/spotwork/domain/job/dto/JobSearchCondition.java, src/main/java/com/ilson/spotwork/domain/job/dto/JobSummaryResponse.java
category, workDate, minWage, maxWage 필드를 가진 JobSearchConditionJob 엔티티로부터 변환하는 from() 팩토리 메서드를 포함한 JobSummaryResponse DTO 신규 추가.
QueryDSL 리포지토리 인터페이스 및 구현
src/main/java/com/ilson/spotwork/domain/job/repository/JobQueryRepository.java, ...JobQueryRepositoryImpl.java, ...JobRepository.java
JobQueryRepository 인터페이스 정의, OPEN 상태·카테고리·근무일·시급 범위 null 분기 필터와 총 건수 별도 쿼리를 포함한 JobQueryRepositoryImpl 구현, JobRepository에 상속 추가.
JobService 트랜잭션 재구성 및 search 메서드
src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
클래스 레벨 @Transactional(readOnly=true) 적용 후 쓰기 메서드에만 @Transactional override, search 메서드에 minWage > maxWage 검증 및 INVALID_INPUT 예외 처리 추가.
JobController search 엔드포인트 및 인가 추가
src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
register@PreAuthorize("hasRole('EMPLOYER')") 추가, 기존 getList 제거 후 선택적 필터 파라미터를 받아 Page<JobSummaryResponse>를 반환하는 search 엔드포인트로 교체.
타입 불일치 예외 핸들러
src/main/java/com/ilson/spotwork/common/exception/GlobalExceptionHandler.java
MethodArgumentTypeMismatchException 발생 시 HTTP 400과 파라미터명을 포함한 오류 메시지를 반환하는 핸들러 메서드 추가.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • kosy00/ilson#24: JobControllergetList 및 CRUD 엔드포인트를 최초 추가한 PR으로, 이번 PR에서 getListsearch로 교체하는 변경과 직접 연관됨.

Poem

🐇 토끼가 공고 검색을 도와드려요~
category, date, wage로 쏙쏙 필터링!
QueryDSL로 달려가는 쿼리,
OPEN 공고만 솎아내어
Page로 착착 담아 드립니다 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 검색 기능 외에 등록 권한 추가와 서비스 트랜잭션 리팩터링이 포함되어 있어 이슈 범위를 일부 벗어납니다. 검색/필터링과 직접 관련 없는 변경은 별도 PR로 분리하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 61.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 공고 검색과 필터링 로직 구현이라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 템플릿의 관련 이슈, 구현 내용, 변경 사항, 체크리스트를 모두 포함해 설명이 충분합니다.
Linked Issues check ✅ Passed category, workDate, minWage/maxWage 필터와 복수 조건 결합 검색이 반영되어 이슈 #22 요구사항을 충족합니다.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/22-job-search

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: 4

🤖 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 46-48: The JobController search endpoint is currently mapped to
the base jobs path instead of the expected search path, which can conflict with
other job routes. Update the `@GetMapping` on the search method in JobController
so the search handler is exposed as /search under the jobs controller, and make
sure the existing search logic in search still serves GET /api/jobs/search as
required by the PR contract.
- Around line 53-55: In JobController, the search endpoint’s size parameter is
only validated with `@Positive`, so it can still be arbitrarily large and flow
into PageRequest and the downstream QueryDSL limit. Add an upper-bound
validation such as `@Max` on the size request parameter in the search method,
keeping the existing pagination setup with PageRequest.of and the controller
method signature otherwise unchanged.

In
`@src/main/java/com/ilson/spotwork/domain/job/repository/JobQueryRepositoryImpl.java`:
- Around line 28-38: `JobQueryRepositoryImpl`의 조회 쿼리는 `offset/limit`만 적용하고
`Pageable`의 정렬을 반영하지 않아 페이지 결과가 불안정합니다. `JobQueryRepositoryImpl`의
`queryFactory.selectFrom(job)` 체인에 `orderBy(...)`를 추가해 `pageable.getSort()`를
Querydsl 정렬로 변환해 적용하거나, 최소한 `createdAt DESC`가 항상 반영되도록 하세요. `content` 조회와 함께
`pageable.getOffset()`/`getPageSize()` 전에 정렬이 먼저 적용되도록 수정해 `JobController`에서 전달된
`PageRequest`의 순서가 실제 쿼리에 반영되게 하세요.

In `@src/main/java/com/ilson/spotwork/domain/job/service/JobService.java`:
- Around line 131-135: Update JobService.search so it also rejects negative wage
inputs before calling jobRepository.search. The current validation only checks
minWage > maxWage; extend the existing guard in search(JobSearchCondition,
Pageable) to throw CustomException(ErrorCode.INVALID_INPUT) when either
cond.getMinWage() or cond.getMaxWage() is below 0, alongside the current range
check.
🪄 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: 889eb6b7-3d41-4f67-b72f-38372fc02bca

📥 Commits

Reviewing files that changed from the base of the PR and between 22ae382 and 610f9df.

📒 Files selected for processing (10)
  • build.gradle
  • src/main/java/com/ilson/spotwork/common/config/QuerydslConfig.java
  • src/main/java/com/ilson/spotwork/common/exception/GlobalExceptionHandler.java
  • src/main/java/com/ilson/spotwork/domain/job/controller/JobController.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobSearchCondition.java
  • src/main/java/com/ilson/spotwork/domain/job/dto/JobSummaryResponse.java
  • src/main/java/com/ilson/spotwork/domain/job/repository/JobQueryRepository.java
  • src/main/java/com/ilson/spotwork/domain/job/repository/JobQueryRepositoryImpl.java
  • src/main/java/com/ilson/spotwork/domain/job/repository/JobRepository.java
  • src/main/java/com/ilson/spotwork/domain/job/service/JobService.java

Comment thread src/main/java/com/ilson/spotwork/domain/job/service/JobService.java
@kosy00
kosy00 merged commit 21c2892 into develop Jul 3, 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] 공고 검색 및 필터링

1 participant