Skip to content

[Fix] 모집 예정 공고 조회 시 일정 데이터 미반환 문제 수정#167

Merged
seoyeon83 merged 1 commit into
mainfrom
fix/#166-recruitment-status-upcoming
Jun 7, 2026
Merged

[Fix] 모집 예정 공고 조회 시 일정 데이터 미반환 문제 수정#167
seoyeon83 merged 1 commit into
mainfrom
fix/#166-recruitment-status-upcoming

Conversation

@seoyeon83

@seoyeon83 seoyeon83 commented Jun 7, 2026

Copy link
Copy Markdown
Member

💡 개요

🪐 주요 변경 사항

  • findCurrentOrUpcoming 쿼리 추가 — endDate 미경과 공고 중 startDate 가장 임박한 것 반환 (모집 중 + 예정 공고 모두 포함)
  • getRecruitmentStatus: 예정 공고 존재 시 is_active: false여도 term 반환
  • getRecruitment: is_active 여부와 무관하게 start_date, end_date, schedule, brochure_url 등 모든 필드 반환 (brochure_url은 미등록 시 null)

✅ 상세 내용

  • 기존 findActiveRecruitment는 모집 중인 공고만 잡아 예정 공고의 term을 /status에서 내려줄 수 없었음
  • findCurrentOrUpcomingendDate >= now 조건으로 모집 중 + 예정을 함께 조회하고, r.isActive(now)is_active 값을 정확히 계산
  • 기존 RecruitmentResponse.from(recruitment, isActive) 생성자는 is_active: false일 때 날짜/일정 필드를 null로 덮어쓰는 문제가 있어, from(recruitment, now()) 생성자로 교체

🔔 참고 사항

  • 프론트 분기 기준: term 없음 → 섹션 미렌더 / term 있고 is_active: false → 시작일까지 D-day + 사전알림 / term 있고 is_active: true → 마감일까지 카운트다운
  • 다음 모집 공고는 일정 확정 시(모집 시작 2~3주 전) 운영팀이 DB에 미리 등록 필요

변경 목적

모집 예정 공고 조회 시 일정 데이터가 반환되지 않는 문제를 해결하기 위해, 리포지토리 쿼리를 추가하고 서비스 로직을 개선하여 활성 공고뿐만 아니라 예정 공고도 함께 조회하고 일정 정보를 정상 반환하도록 수정했습니다.

주요 변경 내용

Repository 레이어

  • findCurrentOrUpcoming(LocalDateTime now) 메서드 추가: endDate가 현재 이후인 공고 중 startDate가 가장 임박한 공고 1건 조회 (활성 + 예정 공고 포함)

Service 레이어

  • getRecruitmentStatus(): 기존 활성 모집만 조회하던 방식에서 현재/예정 공고 조회로 변경; 예정 공고 존재 시에도 일정(term) 정보 반환
  • getRecruitment(): is_active 값과 무관하게 start_date, end_date, schedule, brochure_url 등 모든 날짜/일정 필드 반환

Test 레이어

  • 예정 공고 생성 헬퍼 메서드 추가
  • 리포지토리 스태빙을 findActiveRecruitment()에서 findCurrentOrUpcoming()으로 변경
  • 예정 공고(is_active:false) 케이스에 대한 테스트 커버리지 확충

영향 범위

  • API 변경: /status 엔드포인트가 예정 공고의 일정(term) 정보를 추가로 반환
  • DB 스키마 변경: 없음
  • 설정 변경: 없음

- findCurrentOrUpcoming 쿼리 추가: endDate 미경과 공고 중 startDate 가장 임박한 것 반환
- getRecruitmentStatus: 예정 공고 존재 시 is_active:false여도 term 반환
- getRecruitment: is_active 여부와 무관하게 모든 필드 반환
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

📋 전체 요약

모집 공고 조회 흐름을 "활성 모집만" → "현재 또는 예정 모집"으로 개선했습니다. 저장소에 새로운 쿼리 메서드를 추가하고, 서비스에서 이를 활용하여 isActive 판정을 개선하며, 테스트 커버리지를 예정 공고까지 확장했습니다.


🔄 주요 변경 사항

모집 공고 조회 개선

레이어 / 파일(들) 설명
저장소 쿼리 메서드 추가
src/main/java/com/boaz/backend/domain/recruitment/repository/RecruitmentRepository.java
findCurrentOrUpcoming(LocalDateTime now) 메서드를 추가하여 종료되지 않은 공고를 시작일 기준으로 정렬해 가장 임박한 1건을 반환합니다. 이를 통해 현재 진행 중인 공고뿐 아니라 예정된 공고도 함께 조회할 수 있습니다.
서비스 로직 업데이트
src/main/java/com/boaz/backend/domain/recruitment/service/RecruitmentService.java
getRecruitmentStatus()가 새로운 저장소 메서드를 활용하도록 변경되고, 조회 결과를 기준 시각으로 isActive 판정해 응답을 구성합니다. getRecruitment(term)도 isActive 계산 방식을 개선하여 기준 시각을 직접 전달하도록 수정했습니다.
테스트 데이터 및 검증 확장
src/test/java/com/boaz/backend/domain/recruitment/service/RecruitmentServiceTest.java
예정 공고 생성 헬퍼(createUpcomingRecruitment())를 추가하고, 기존 테스트의 저장소 스태빙을 findCurrentOrUpcoming 기반으로 통일했습니다. 경계 조건 검증을 고정된 시각 방식으로 개선하고, 예정 공고가 isActive:false로 정확히 판정되는지 검증하는 케이스들을 추가했습니다.

🎯 4 (Complex) | ⏱️ ~35분

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 changeset의 주요 변경 사항을 명확히 반영하고 있습니다. '모집 예정 공고 조회 시 일정 데이터 미반환 문제 수정'은 핵심 이슈(예정 공고의 일정 데이터 미반환)와 해결 방안(수정)을 간결하게 표현합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#166-recruitment-status-upcoming

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 and usage tips.

@seoyeon83 seoyeon83 self-assigned this Jun 7, 2026

@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.

🧹 Nitpick comments (1)
src/main/java/com/boaz/backend/domain/recruitment/repository/RecruitmentRepository.java (1)

17-19: JPQL LIMIT 호환성 우려: 현재(Spring Boot 3.4.3)에서는 리스크가 낮습니다.

build.gradleorg.springframework.boot 3.4.3이 지정돼 있어(= Hibernate 6 계열) @QueryLIMIT 1 문법이 런타임에서 깨질 가능성은 낮습니다.
다만 더 표준/이식성을 원하면 Pageable 또는 fetch first 1 row only 같은 방식으로 바꾸는 건 선택사항입니다.

🤖 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/boaz/backend/domain/recruitment/repository/RecruitmentRepository.java`
around lines 17 - 19, The JPQL query in RecruitmentRepository (method
findCurrentOrUpcoming) uses a non-standard "LIMIT 1"; update it for
compatibility by removing "LIMIT 1" and either (a) change the repository method
to accept a Pageable (e.g., PageRequest.of(0,1)) and return Optional/List/Stream
accordingly while keeping "ORDER BY r.startDate ASC" in the `@Query`, or (b)
replace the `@Query` with a native SQL using "fetch first 1 row only" and set
nativeQuery=true; adjust the method signature and call sites to use the chosen
approach so only one result is returned reliably across JPA providers.
🤖 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.

Nitpick comments:
In
`@src/main/java/com/boaz/backend/domain/recruitment/repository/RecruitmentRepository.java`:
- Around line 17-19: The JPQL query in RecruitmentRepository (method
findCurrentOrUpcoming) uses a non-standard "LIMIT 1"; update it for
compatibility by removing "LIMIT 1" and either (a) change the repository method
to accept a Pageable (e.g., PageRequest.of(0,1)) and return Optional/List/Stream
accordingly while keeping "ORDER BY r.startDate ASC" in the `@Query`, or (b)
replace the `@Query` with a native SQL using "fetch first 1 row only" and set
nativeQuery=true; adjust the method signature and call sites to use the chosen
approach so only one result is returned reliably across JPA providers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a76cc16-054f-471c-bfe9-9a91ae2090fa

📥 Commits

Reviewing files that changed from the base of the PR and between 6a0d829 and 113c2af.

📒 Files selected for processing (3)
  • src/main/java/com/boaz/backend/domain/recruitment/repository/RecruitmentRepository.java
  • src/main/java/com/boaz/backend/domain/recruitment/service/RecruitmentService.java
  • src/test/java/com/boaz/backend/domain/recruitment/service/RecruitmentServiceTest.java

@seoyeon83
seoyeon83 merged commit 42c2d8c into main Jun 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants