Skip to content

feat: AI 코스 후보 추천 기능 구현 - #44

Merged
hyeoniss merged 4 commits into
developfrom
feat/ai-course
Aug 6, 2026
Merged

hyeoniss merged 4 commits into
developfrom
feat/ai-course

Conversation

@hyeoniss

@hyeoniss hyeoniss commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

📌 관련 이슈


🔎 What is this PR?

POST /courses/ai-recommendations

✨ Changes

  • Naver 지역검색 API로 지역별 식당·카페·놀거리 후보를 조회합니다.
  • 조회한 장소는 Place에 저장하거나 기존 장소와 매핑합니다.
  • Gemini가 장소별 1인 평균 이용 금액 범위, 신뢰도, 추론 근거를 생성합니다.
  • 가격 추론 결과는 PlacePriceEstimate에 저장해 동일 장소 재요청 시 AI 호출 없이 재사용합니다.
  • 세 유형의 장소를 조합한 뒤, 추정 최소·최대 총액이 사용자가 요청한 예산 범위에 포함되는 코스만 최대 2개 반환합니다.
  • 추천 가능한 조합이 없으면 COMMON200, 빈 result, 해당 조건의 장소가 없습니다. 메시지를 반환합니다.
  • 성공 응답을 명세의 success, code, message, result 구조로 맞췄습니다.
  • 요청값 검증 및 존재하지 않는 지역 예외 처리를 추가했습니다.

📷 Result


💬 To. Reviewer

  • 동일한 지역·예산 요청은 Naver 후보와 저장된 AI 가격 추정값을 재사용하고 가격순으로 정렬하므로, 같은 코스가 반복 반환될 수 있습니다. 요청마다 다른 코스를 반환하는 랜덤화·최근 추천 제외 정책은 현재 명세 범위에 포함하지 않았습니다.
  • Naver 지역검색 API는 실제 네이버 플레이스 ID를 제공하지 않습니다.😭 따라서 현재 naverPlaceId에는 응답 link를 우선 사용하고, link가 없는 경우 중복 방지용 내부 해시 키를 사용합니다.

✅ 체크 리스트

  • base 브랜치(develop 또는 main) 최신 상태 pull 및 충돌 확인 완료
  • Reviewers 설정
  • Assignees 설정
  • Labels 설정

Summary by CodeRabbit

  • New Features
    • Added AI-powered course recommendations based on region and price range.
    • Recommendations include course details, places, estimated costs, pricing confidence, and explanations.
    • Added validation for required regions and valid minimum and maximum prices.
  • Error Handling
    • Added a clear error response when course recommendations cannot be generated.

@hyeoniss hyeoniss linked an issue Aug 4, 2026 that may be closed by this pull request
2 tasks
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@hyeoniss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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

How do review 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 refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 38d3cb7d-ccc2-4d2e-acdf-eea99b06dc20

📥 Commits

Reviewing files that changed from the base of the PR and between 7451bea and 2af1a0a.

📒 Files selected for processing (3)
  • src/main/java/com/daytodo/domain/course/controller/CourseController.java
  • src/main/java/com/daytodo/domain/place/entity/PlacePriceEstimate.java
  • src/test/java/com/daytodo/global/config/TargetApiSecurityTest.java
📝 Walkthrough

Walkthrough

Changes

The PR adds a validated AI course recommendation API. It defines recommendation response records, supports place lookup and construction, adds a recommendation failure code, permits unauthenticated endpoint access, and updates affected test fixtures.

AI course recommendation

Layer / File(s) Summary
Recommendation request and response contracts
src/main/java/com/daytodo/domain/course/dto/CourseRequest.java, src/main/java/com/daytodo/domain/course/dto/CourseResponse.java
The request validates region and price ranges. Response records expose recommended courses and places with immutable list fields.
Recommendation endpoint and access rule
src/main/java/com/daytodo/domain/course/controller/CourseController.java, src/main/java/com/daytodo/global/config/SecurityConfig.java, src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
The controller exposes POST /courses/ai-recommendations and delegates to CourseAiRecommendationService. Security permits unauthenticated access. A recommendation failure code returns HTTP 409.
Place data construction and lookup support
src/main/java/com/daytodo/domain/place/entity/Place.java, src/main/java/com/daytodo/domain/place/entity/PlacePriceEstimate.java, src/main/java/com/daytodo/domain/place/repository/PlaceRepository.java, src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java, src/test/java/com/daytodo/global/config/TargetApiSecurityTest.java
Place and price estimate constructors initialize recommendation data. The repository looks up places by Naver place ID. Test fixtures include the required mocks and service dependency.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SecurityConfig
  participant CourseController
  participant CourseAiRecommendationService
  Client->>SecurityConfig: POST /courses/ai-recommendations
  SecurityConfig->>CourseController: Permit request
  CourseController->>CourseAiRecommendationService: recommend(request)
  CourseAiRecommendationService-->>CourseController: AiRecommendations
  CourseController-->>Client: AiRecommendations response
Loading

Possibly related PRs

Suggested labels: ✨ feature

Suggested reviewers: yxpjseo, kwonwnsduf

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The unauthenticated recommendation endpoint rule is a temporary security bypass not required by issue #42. Remove the unauthenticated rule or track it in a separate, explicitly approved testing task.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the implemented AI course candidate recommendation feature.
Linked Issues check ✅ Passed The changes add the AI recommendation endpoint and supporting components required for issue #42.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ai-course

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

🧹 Nitpick comments (1)
src/test/java/com/daytodo/global/config/TargetApiSecurityTest.java (1)

60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for unauthenticated AI recommendations.

@MockitoBean only supplies the new CourseController dependency. The current tests do not verify that POST /courses/ai-recommendations is permitted without a JWT. Stub courseAiRecommendationService.recommend(...), send a valid request without Authorization, and verify the response and service call.

🤖 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/test/java/com/daytodo/global/config/TargetApiSecurityTest.java` at line
60, Add a new test method in TargetApiSecurityTest that verifies unauthenticated
access to the POST /courses/ai-recommendations endpoint is permitted. Stub the
courseAiRecommendationService.recommend method to return a valid response, send
a request to the endpoint without an Authorization header, and assert both that
the HTTP response is successful and that the mocked service method was invoked
as expected.
🤖 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/daytodo/domain/place/entity/PlacePriceEstimate.java`:
- Around line 42-49: Update the PlacePriceEstimate constructor to validate that
maxPrice is greater than or equal to minPrice before assigning the fields,
rejecting invalid ranges so they cannot reach persistence or budget
calculations. Preserve valid estimates and use the class’s established
validation or exception convention if one exists.

---

Nitpick comments:
In `@src/test/java/com/daytodo/global/config/TargetApiSecurityTest.java`:
- Line 60: Add a new test method in TargetApiSecurityTest that verifies
unauthenticated access to the POST /courses/ai-recommendations endpoint is
permitted. Stub the courseAiRecommendationService.recommend method to return a
valid response, send a request to the endpoint without an Authorization header,
and assert both that the HTTP response is successful and that the mocked service
method was invoked as expected.
🪄 Autofix

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 734de13f-c72e-46ec-8a42-e756de061b05

📥 Commits

Reviewing files that changed from the base of the PR and between 716c0b8 and 7451bea.

📒 Files selected for processing (10)
  • src/main/java/com/daytodo/domain/course/controller/CourseController.java
  • src/main/java/com/daytodo/domain/course/dto/CourseRequest.java
  • src/main/java/com/daytodo/domain/course/dto/CourseResponse.java
  • src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
  • src/main/java/com/daytodo/domain/place/entity/Place.java
  • src/main/java/com/daytodo/domain/place/entity/PlacePriceEstimate.java
  • src/main/java/com/daytodo/domain/place/repository/PlaceRepository.java
  • src/main/java/com/daytodo/global/config/SecurityConfig.java
  • src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java
  • src/test/java/com/daytodo/global/config/TargetApiSecurityTest.java

@kwonwnsduf kwonwnsduf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고하셨습니다!

@hyeoniss
hyeoniss merged commit 13ff3e0 into develop Aug 6, 2026
1 check passed
@hyeoniss
hyeoniss deleted the feat/ai-course branch August 6, 2026 07:31
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.

[Feat] 코스 구성 AI 장소 추천 기능 구현

2 participants