Skip to content

Conversation

@chaechaen
Copy link
Member

@chaechaen chaechaen commented Dec 5, 2025

📝 작업 내용
- SliceResposne 클래스 추가해 무한스크롤 해당 방식으로 응답 통일

Summary by CodeRabbit

  • Refactor
    • Optimized the pagination mechanism for retrieving ongoing amateur shows to deliver faster API responses with reduced data transfer. Users will notice improved performance when browsing amateur show listings, with more efficient pagination navigation throughout available content. This enhancement maintains the same intuitive browsing experience while reducing bandwidth consumption and server load.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Walkthrough

This pull request refactors the getShowOngoing pagination API to migrate from Spring Data's Page to Slice, introducing a new SliceResponse DTO wrapper for API responses. The change affects the controller, service interface, and service implementation layers.

Changes

Cohort / File(s) Summary
Pagination Infrastructure
src/main/java/cc/backend/apiPayLoad/SliceResponse.java
New generic DTO class SliceResponse<T> added to wrap Slice pagination responses, with fields: content, page, size, first, last, hasNext, and a static factory method of(Slice<T> slice) to convert Spring Data Slice objects.
Service Layer Updates
src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurService.java, src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurServiceImpl.java
Updated getShowOngoing return type from Page<AmateurShowResponseDTO.AmateurShowList> to Slice<AmateurShowResponseDTO.AmateurShowList>; implementation refactored to use SliceImpl instead of PageImpl with hasNext computed from boundary comparison; imports adjusted accordingly.
Controller Layer Updates
src/main/java/cc/backend/amateurShow/controller/AmateurController.java
Updated getShowOngoing return type to ApiResponse<SliceResponse<AmateurShowList>>; implementation wraps service-returned Slice with SliceResponse.of(); imports updated to use Slice instead of Page.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify that Slice semantics (no total count, hasNext only) are appropriate for this endpoint's use case
  • Confirm SliceResponse.of() correctly maps all Slice properties, especially the hasNext calculation in AmateurServiceImpl
  • Check that any downstream consumers of the pagination API can handle the absence of total page/element counts from Slice

Poem

🐰 Hop, hop—from Pages to Slices we go,
No counts overhead, just the next in a row!
With SliceResponse neat, the API's reborn,
Leaner, meaner, pagination reform! 🍕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description addresses the work done but is incomplete. It only fills the '작업 내용' section and omits other template sections. Add the missing sections: specify related issue numbers in '연관된 이슈', and optionally include screenshots or review requirements if applicable.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[FIX] Slice 페이징 방식 추가' clearly summarizes the main change: adding Slice pagination approach to the codebase.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/111/kakaopayStock

📜 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 ccb2fd9 and 9a07924.

📒 Files selected for processing (4)
  • src/main/java/cc/backend/amateurShow/controller/AmateurController.java (2 hunks)
  • src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurService.java (1 hunks)
  • src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurServiceImpl.java (3 hunks)
  • src/main/java/cc/backend/apiPayLoad/SliceResponse.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/cc/backend/amateurShow/controller/AmateurController.java (1)
src/main/java/cc/backend/amateurShow/dto/AmateurShowResponseDTO.java (1)
  • AmateurShowResponseDTO (12-122)
🔇 Additional comments (7)
src/main/java/cc/backend/apiPayLoad/SliceResponse.java (2)

11-34: LGTM! Clean DTO structure with proper documentation.

The class structure follows standard patterns with Lombok annotations and includes helpful Swagger documentation for all fields.


35-44: LGTM! Factory method correctly maps all Slice fields.

The static factory method properly extracts and maps all fields from Spring Data's Slice interface to the DTO.

src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurServiceImpl.java (2)

413-413: LGTM! Method signature correctly updated to return Slice.

The return type change aligns with the PR objective to migrate to Slice-based pagination.


447-454: LGTM! Correct Slice construction with proper edge case handling.

The implementation correctly:

  • Guards against IndexOutOfBoundsException when the offset exceeds the result size
  • Calculates hasNext to indicate whether more data is available
  • Constructs the SliceImpl with the appropriate parameters
src/main/java/cc/backend/amateurShow/service/amateurShowService/AmateurService.java (1)

23-23: LGTM! Interface correctly updated to return Slice.

The method signature change properly reflects the migration from Page to Slice pagination.

src/main/java/cc/backend/amateurShow/controller/AmateurController.java (2)

6-6: LGTM! Imports correctly updated for Slice pagination.

The necessary imports for SliceResponse and Slice have been added, and the explicit import of AmateurShowList improves code clarity.

Also applies to: 10-10, 19-19


79-84: LGTM! Controller correctly wraps Slice in SliceResponse.

The implementation properly:

  • Updates the API response type to use the new SliceResponse wrapper
  • Transforms the service layer's Slice into the API DTO at the controller boundary
  • Maintains clean separation between service and presentation layers

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.

@yhi9839 yhi9839 merged commit 4647810 into develop Dec 31, 2025
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.

3 participants