Skip to content

Conversation

@kamillcream
Copy link
Contributor

@kamillcream kamillcream commented Sep 3, 2025

📌 PR 개요

  • 관광지 조회수 증가 및 조회수 순위로 검색

✅ 변경사항

  • 상세 페이지 api 호출 시 조회수 증가
  • 매일 자정 기준 조회수 초기화는 DB 스케줄링으로 동작.

🔍 체크리스트

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

📎 관련 이슈

Closes #71


💬 기타 참고사항

Summary by CodeRabbit

  • 신규 기능
    • 인기 순위 관광지 조회 엔드포인트 추가: 상위 10개 관광지 메타 정보를 조회할 수 있습니다. 이미지와 현재 혼잡도 정보가 함께 제공됩니다.
  • 개선
    • 관광지 상세 페이지 조회 시 조회수가 자동으로 증가하여 인기 순위에 반영됩니다.

@kamillcream kamillcream linked an issue Sep 3, 2025 that may be closed by this pull request
2 tasks
@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

랭킹 조회용 GET /rank 엔드포인트가 추가되고, 서비스/레포지토리 계층에 조회수 기준 상위 10개 관광지 메타 조회 로직이 구현되었습니다. 상세 조회 로직에 조회수 증가가 포함되며, 엔티티에 viewCount 필드와 증가 메서드가 추가되었습니다.

Changes

Cohort / File(s) Summary
Controller
src/main/java/.../tourspot/controller/TourSpotController.java
GET /rank 추가: 서비스 combineTourSpotByRank() 호출해 ApiResponse<List<TourSpotMetaResponse>> 반환. 기존 엔드포인트 유지.
Service
src/main/java/.../tourspot/service/TourSpotService.java
상세 조회 combineTourSpotDetail(Long)@Transactional 추가 및 조회수 증가 적용. 랭킹 조회 combineTourSpotByRank() 신설.
Repository (custom + impl)
src/main/java/.../repository/custom/total/CustomTourSpotCombineRepository.java, .../CustomTourSpotCombineRepositoryImpl.java
findMetaByRank() 인터페이스/구현 추가: viewCount 내림차순 상위 10개를 이미지/혼잡도 조인으로 조회하여 TourSpotMetaResponse 매핑.
Entity
src/main/java/.../tourspot/entity/TourSpot.java
viewCount: Integer 필드 추가 및 increaseViewCount() 메서드 추가.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Client (Landing)
    participant Ctrl as TourSpotController
    participant Svc as TourSpotService
    participant Repo as CustomTourSpotCombineRepository
    participant DB as Database

    C->>Ctrl: GET /tourspots/rank
    Ctrl->>Svc: combineTourSpotByRank()
    Svc->>Repo: findMetaByRank()
    Repo->>DB: SELECT top 10 by viewCount<br/>LEFT JOIN image, current congestion
    DB-->>Repo: List<TourSpotMetaResponse>
    Repo-->>Svc: results
    Svc-->>Ctrl: results
    Ctrl-->>C: 200 OK ApiResponse<List<...>>
Loading
sequenceDiagram
    autonumber
    participant C as Client (Detail)
    participant Ctrl as TourSpotController
    participant Svc as TourSpotService
    participant JPA as JPA/Repository
    participant DB as Database

    C->>Ctrl: GET /tourspots/{id}
    Ctrl->>Svc: combineTourSpotDetail(id)
    rect rgba(230,245,255,0.5)
      note right of Svc: Transactional
      Svc->>JPA: findById(id)
      JPA->>DB: SELECT TourSpot
      DB-->>JPA: TourSpot
      Svc->>Svc: increaseViewCount()
      Svc->>JPA: save(updated TourSpot)
    end
    Svc-->>Ctrl: TourSpotDetailResponse
    Ctrl-->>C: 200 OK
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Assessment against linked issues

Objective Addressed Explanation
상세 페이지 접속 시 조회수 +1 처리 [#71]
조회수 상위 10개 랭킹 데이터 제공 [#71]
매일 00시 조회수 초기화 스케줄러/로직 [#71] 초기화 관련 스케줄러/배치/쿼리 부재.

Assessment against linked issues: Out-of-scope changes

(해당 없음)

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • 7ijin01

Poem

당근 같은 해, 순위는 싹—랭킹 탑!
살짝 들어가면 뿅, 조회수는 업!
열 개 별빛 주워 담아 랜딩에 척,
자정의 종은 아직이니, 다음에 쳐억.
귀가 팔랑, 코드도 출렁—깡총! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 46c2d96 and e7c9bad.

📒 Files selected for processing (5)
  • src/main/java/com/opendata/domain/tourspot/controller/TourSpotController.java (1 hunks)
  • src/main/java/com/opendata/domain/tourspot/entity/TourSpot.java (2 hunks)
  • src/main/java/com/opendata/domain/tourspot/repository/custom/total/CustomTourSpotCombineRepository.java (1 hunks)
  • src/main/java/com/opendata/domain/tourspot/repository/custom/total/CustomTourSpotCombineRepositoryImpl.java (1 hunks)
  • src/main/java/com/opendata/domain/tourspot/service/TourSpotService.java (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#71-tourspot-view-count

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kamillcream kamillcream merged commit bbfb597 into main Sep 3, 2025
1 of 2 checks passed
@kamillcream kamillcream deleted the feat/#71-tourspot-view-count branch September 3, 2025 20:44
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] 관광지 조회수 로직 추가

2 participants