Skip to content

[refactor] 장소 상세 api에 리뷰 추가#359

Merged
88guri merged 4 commits intodevelopfrom
refactor/#358/add-three-review
Apr 10, 2026
Merged

[refactor] 장소 상세 api에 리뷰 추가#359
88guri merged 4 commits intodevelopfrom
refactor/#358/add-three-review

Conversation

@88guri
Copy link
Copy Markdown
Contributor

@88guri 88guri commented Apr 10, 2026

🌳이슈 번호


resolves #358


☀️어떻게 이슈를 해결했나요?


  • 장소 상세 API에서 리뷰 데이터를 함께 내려주기 위해 PlaceReviewRepository를 활용하여 최신순 리뷰를 조회
  • Service 레이어에서 Stream API의 .limit(3)을 사용해 최신 3개만 추출
  • 각 리뷰는 PlaceLatestReviewDto.from()을 통해 응답 DTO로 변환
  • 변환된 리스트를 PlaceDetailsGetResponse에 포함시켜 프론트에서 바로 사용할 수 있도록 구성

🗯️ PR 포인트

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요


테스팅 화면

image image image image

Summary by CodeRabbit

  • 새로운 기능

    • 장소 상세에 최신 리뷰 최대 3개 노출: 리뷰어 닉네임·프로필 이미지, 방문 일자·시간대, 내용 및 이미지가 표시됩니다.
    • 장소 상세 조회 시 최신 리뷰를 함께 제공하도록 서비스 응답이 확장되었습니다.
  • 문서

    • 리뷰 관련 API에 OpenAPI/Swagger 주석이 추가되어 API 문서화가 향상되었습니다.

@88guri 88guri requested a review from uykm April 10, 2026 13:01
@88guri 88guri self-assigned this Apr 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

Walkthrough

장소 상세 조회 응답에 최신 리뷰 최대 3개를 포함하도록 변경되었습니다. 새로운 DTO PlaceLatestReviewDto를 추가하고, 서비스에서 최신 리뷰를 조회하여 이미지 URL을 변환한 뒤 PlaceDetailsGetResponse에 포함하도록 구현했습니다.

Changes

Cohort / File(s) Summary
새 DTO 추가
src/main/java/org/sopt/solply_server/domain/place/dto/PlaceLatestReviewDto.java
리뷰 메타데이터(리뷰ID, 사용자ID, 닉네임, 프로필 이미지 URL, 내용, 방문일, 방문시간대)와 리뷰 이미지 URL 목록을 담는 record 추가. from(PlaceReview, ImageUrlProvider) 정적 팩토리 메서드로 엔티티->DTO 매핑 및 이미지 키를 URL로 변환.
응답 확장
src/main/java/org/sopt/solply_server/domain/place/dto/response/PlaceDetailsGetResponse.java
응답 레코드에 List<PlaceLatestReviewDto> latestReviews 컴포넌트 추가 및 of(...) 팩토리 시그니처에 해당 파라미터를 포함하도록 수정.
서비스 변경 및 통합
src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java
PlaceReviewRepository 의존성 추가. getPlaceDetailsById(...)에서 최신 리뷰 3건을 findTop3ByPlaceIdOrderByCreatedAtDesc(...)로 조회하고 PlaceLatestReviewDto.from(...)로 매핑하여 응답에 포함하도록 로직 추가(파일 내 포맷팅/재정렬 일부 포함).
레포지토리 확장
src/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.java
List<PlaceReview> findTop3ByPlaceIdOrderByCreatedAtDesc(Long placeId) 메서드 추가: placeId 기준 최신 3개 리뷰 조회 쿼리 메서드.
컨트롤러 주석 추가
src/main/java/org/sopt/solply_server/domain/review/controller/PlaceReviewController.java
Swagger/OpenAPI 어노테이션(@Tag, @Operation, @Parameter) 추가—기능 변화 없음(문서주석 추가).

Sequence Diagram

sequenceDiagram
    participant Client
    participant PlaceService
    participant PlaceRepository
    participant PlaceReviewRepository
    participant ImageUrlProvider
    participant Database

    Client->>PlaceService: getPlaceDetailsById(placeId)
    PlaceService->>PlaceRepository: 조회 요청 (placeId)
    PlaceRepository->>Database: SELECT place WHERE id=placeId
    Database-->>PlaceRepository: Place 반환
    PlaceRepository-->>PlaceService: Place 반환

    PlaceService->>PlaceReviewRepository: 최신 3개 리뷰 조회 (placeId)
    PlaceReviewRepository->>Database: SELECT ... ORDER BY createdAt DESC LIMIT 3
    Database-->>PlaceReviewRepository: PlaceReview 목록 반환
    PlaceReviewRepository-->>PlaceService: PlaceReview 목록 반환

    PlaceService->>ImageUrlProvider: user.profileImageKey -> URL (for each review.user)
    ImageUrlProvider-->>PlaceService: profileImageUrl 반환
    PlaceService->>ImageUrlProvider: reviewImage.imageKey -> URL (for each image)
    ImageUrlProvider-->>PlaceService: imageUrls 반환

    PlaceService->>PlaceService: PlaceLatestReviewDto.from(...) 매핑 (리스트)
    PlaceService->>PlaceService: PlaceDetailsGetResponse.of(..., latestReviews)
    PlaceService-->>Client: PlaceDetailsGetResponse (latestReviews 포함)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • uykm
  • bykbyk0401

Poem

🐰 세 개의 리뷰를 살포시 들고와
장소 상세에 소곤소곤 놓아두네
사진은 반짝 URL로 빛나고
닉네임은 웃음으로 번지면
페이지가 살며시 풍성해지네 ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% 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 제목은 '장소 상세 api에 리뷰 추가'로 주요 변경사항을 정확하게 설명하며, 변경 내용과 완벽하게 일치합니다.
Linked Issues check ✅ Passed PR은 #358의 요구사항인 '장소 상세 페이지에 리뷰 최신순 3개 같이 내려주기'를 완전히 충족합니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 #358 이슈 범위 내에 있습니다. 리뷰 DTO, API 응답 구조, 저장소 쿼리, Swagger 문서화 모두 리뷰 기능 추가와 직접 관련됩니다.

✏️ 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 refactor/#358/add-three-review

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java`:
- Around line 90-95: The current code in PlaceService uses
placeReviewRepository.findAllByPlaceIdOrderByCreatedAtDesc(...).stream().limit(3)...
which fetches all reviews into memory; change this to query the DB for only
three rows by adding a repository method like
findTop3ByPlaceIdOrderByCreatedAtDesc(Long placeId) in PlaceReviewRepository and
call that from PlaceService instead of findAllByPlaceIdOrderByCreatedAtDesc,
then map the returned List<PlaceReview> to PlaceLatestReviewDto via
PlaceLatestReviewDto.from(review, imageUrlProvider).
🪄 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: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f663c477-d2b0-4b93-9e90-75aad57faf94

📥 Commits

Reviewing files that changed from the base of the PR and between 42b87c9 and 67d8bc5.

📒 Files selected for processing (3)
  • src/main/java/org/sopt/solply_server/domain/place/dto/PlaceLatestReviewDto.java
  • src/main/java/org/sopt/solply_server/domain/place/dto/response/PlaceDetailsGetResponse.java
  • src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java (1)

37-37: 🛠️ Refactor suggestion | 🟠 Major

예외 타입을 BusinessException(ErrorCode)로 통일해 주세요.

Line [116]에서 JwtTokenException을 던지고 있어 현재 저장소 예외 처리 규칙과 불일치합니다.

🔧 제안 변경안
-import org.sopt.solply_server.global.exception.JwtTokenException;
@@
-      throw new JwtTokenException(ErrorCode.UNAUTHORIZED_USER);
+      throw new BusinessException(ErrorCode.UNAUTHORIZED_USER);

As per coding guidelines Use BusinessException(ErrorCode) with GlobalExceptionHandler for exception handling in Spring Boot.

Also applies to: 115-116

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java`
at line 37, PlaceService currently throws JwtTokenException (import
org.sopt.solply_server.global.exception.JwtTokenException) around the token
check; replace that with throwing the unified BusinessException using an
appropriate ErrorCode (e.g., throw new BusinessException(ErrorCode.INVALID_JWT)
or ErrorCode.INVALID_TOKEN) from the same spot (method in PlaceService where
JwtTokenException is thrown), and remove the JwtTokenException import; ensure
the global exception handler will handle BusinessException as per project
convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java`:
- Line 37: PlaceService currently throws JwtTokenException (import
org.sopt.solply_server.global.exception.JwtTokenException) around the token
check; replace that with throwing the unified BusinessException using an
appropriate ErrorCode (e.g., throw new BusinessException(ErrorCode.INVALID_JWT)
or ErrorCode.INVALID_TOKEN) from the same spot (method in PlaceService where
JwtTokenException is thrown), and remove the JwtTokenException import; ensure
the global exception handler will handle BusinessException as per project
convention.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 250875cb-d574-482e-8db1-855dbb855942

📥 Commits

Reviewing files that changed from the base of the PR and between 67d8bc5 and 9d4d7e1.

📒 Files selected for processing (3)
  • src/main/java/org/sopt/solply_server/domain/place/service/PlaceService.java
  • src/main/java/org/sopt/solply_server/domain/review/controller/PlaceReviewController.java
  • src/main/java/org/sopt/solply_server/domain/review/repository/PlaceReviewRepository.java
✅ Files skipped from review due to trivial changes (1)
  • src/main/java/org/sopt/solply_server/domain/review/controller/PlaceReviewController.java

@88guri 88guri merged commit 6b6e1f2 into develop Apr 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] 장소 상세 api에 리뷰 추가

1 participant