Skip to content

Conversation

@7ijin01
Copy link
Member

@7ijin01 7ijin01 commented Sep 15, 2025

📌 PR 개요


✅ 변경사항


🔍 체크리스트

  • PR 제목은 명확한가요?
  • 관련 이슈가 있다면 연결했나요?
  • 로컬 테스트는 통과했나요?
  • 코드에 불필요한 부분은 없나요?

📎 관련 이슈

Closes #83


💬 기타 참고사항

Summary by CodeRabbit

  • API Changes
    • 마이페이지 선호 관광지 엔드포인트가 쿼리 파라미터(tourSpotId) 대신 경로 변수(/{tourspotId})를 사용하도록 변경: POST/DELETE /mypage/preferences/{tourspotId}, GET /mypage/preferences/check/{tourspotId}
  • Improvements
    • CORS 사전요청(OPTIONS) 전역 허용으로 프런트엔드 통신 안정성 개선
    • 월간 혼잡도 자동 갱신 스케줄 활성화: 매일 03:05(KST) 실행, 더 최신 데이터 제공

@7ijin01 7ijin01 linked an issue Sep 15, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Sep 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

요청 파라미터였던 tourSpotId를 경로 변수로 변경하고, 해당 엔드포인트의 URL 매핑을 업데이트했습니다. 스케줄러를 활성화해 월별 혼잡도 갱신 작업을 매일 03:05 KST에 실행하도록 했습니다. 보안 설정에서 모든 OPTIONS 프리플라이트를 허용하고, 투어스팟 관련 서비스 키 프로퍼티 키를 교체했습니다.

Changes

Cohort / File(s) Summary
MyPage 경로 변수 전환
src/main/java/com/opendata/docs/MyPageControllerDocs.java, src/main/java/com/opendata/domain/mypage/controller/MypageController.java
tourSpotId 바인딩을 @RequestParam@PathVariable("tourspotId")로 변경. 매핑 경로를 /mypage/preferences/{tourspotId}, /mypage/preferences/check/{tourspotId}로 업데이트. 문서용 클래스에 @PathVariable 임포트 추가.
투어스팟 월별 스케줄 활성화
src/main/java/com/opendata/domain/tourspot/service/TourSpotService.java
updateMonthlyCongestion@Scheduled(cron = "0 5 3 * * *", zone = "Asia/Seoul") 활성화. 메서드 본문 변경 없음.
API 키 프로퍼티 교체
src/main/java/com/opendata/domain/tourspot/service/TourSpotRelatedService.java
secretKey 초기화 프로퍼티를 api.tour_api_congestion_keyapi.tour_api_tourspot_key로 변경. 요청 파라미터 사용 방식은 동일.
보안 설정 프리플라이트 허용
src/main/java/com/opendata/global/config/SecurityConfig.java
HttpMethod 임포트 추가. OPTIONS "/**" 전면 허용 후, 기존 공개 엔드포인트 목록 허용 유지. 나머지는 인증 필요.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant GW as Spring Security
  participant MC as MypageController
  Note over C,GW: 경로 변수 기반 엔드포인트
  C->>GW: POST /mypage/preferences/{tourspotId}
  GW-->>MC: Authenticated request 전달
  MC-->>C: 200 OK

  C->>GW: DELETE /mypage/preferences/{tourspotId}
  GW-->>MC: Authenticated request 전달
  MC-->>C: 200 OK

  C->>GW: GET /mypage/preferences/check/{tourspotId}
  GW-->>MC: Authenticated request 전달
  MC-->>C: 200 OK/결과
Loading
sequenceDiagram
  autonumber
  participant B as Browser
  participant GW as Spring Security
  Note over B,GW: CORS Preflight 처리
  B->>GW: OPTIONS /any/path (Preflight)
  GW-->>B: 200 OK (permitAll)
Loading
sequenceDiagram
  autonumber
  participant S as Spring Scheduler
  participant TS as TourSpotService
  Note over S,TS: 매일 03:05 Asia/Seoul
  S->>TS: invoke updateMonthlyCongestion()
  TS-->>S: 완료
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • kamillcream

Poem

깡총깡총 경로를 따라 점프해요, /preferences/{id}로!
바람처럼 OPTIONS도 지나가고, CORS는 안녕👋
새벽 세 시 오 분, 시계 토끼가 알람을 울리면⏰
월별 혼잡도도 척척 업데이트!
키도 맞췄으니, 이제 출발~ 데이터 초원으로! 🥕

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#83-CORS

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d7d0ce and 79cbd38.

📒 Files selected for processing (5)
  • src/main/java/com/opendata/docs/MyPageControllerDocs.java (4 hunks)
  • src/main/java/com/opendata/domain/mypage/controller/MypageController.java (3 hunks)
  • src/main/java/com/opendata/domain/tourspot/service/TourSpotRelatedService.java (1 hunks)
  • src/main/java/com/opendata/domain/tourspot/service/TourSpotService.java (1 hunks)
  • src/main/java/com/opendata/global/config/SecurityConfig.java (2 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@7ijin01 7ijin01 merged commit 1b9c8d3 into main Sep 15, 2025
1 of 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.

[fix] CORS Preflight 처리

2 participants