Skip to content

Conversation

@sweatbuckets
Copy link
Contributor

@sweatbuckets sweatbuckets commented Dec 23, 2025

  1. #⃣ 연관된 이슈
    • 관련 이슈를 명시해주세요.
    • 예: #이슈번호#이슈번호
  2. 📝 작업 내용
    • 이번 PR에서 작업한 내용을 간략히 설명해주세요.
    • 필요한 경우 이미지 첨부 가능.
  3. 📸 스크린샷 (선택)
    • 작업 내용을 시각적으로 표현할 스크린샷을 포함하세요.
  4. 💬 리뷰 요구사항 (선택)
    • 리뷰어가 특히 검토해주었으면 하는 부분이 있다면 작성해주세요.
    • 예: "메서드 XXX의 이름을 더 명확히 하고 싶은데, 좋은 아이디어가 있으신가요?"

Summary by CodeRabbit

  • Refactor
    • Updated photo album pagination mechanism from cursor-based to page-based navigation, allowing users to browse albums using page numbers (0-indexed) instead of cursor tokens.
    • Pagination metadata in API responses updated to use nextPage field instead of nextCursor.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Walkthrough

The PR refactors the photo album module's pagination strategy from cursor-based to page-based pagination. This involves replacing Long cursorId parameters with int page parameters across the controller, service layer, repository, and DTOs, including method renames (e.g., getAllPhotoAlbumList → getAllRecentPhotoAlbumList) and updating response fields from nextCursor to nextPage.

Changes

Cohort / File(s) Summary
Controller Layer
src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java
Replaced cursorId (Long, optional) with page (int, defaultValue="0") in getPhotoAlbumList and getAllPhotoAlbum methods; updated service calls accordingly. Modified RequestBody description in uploadPhotoAlbum to reflect only keyName from imageRequestDTOs.
Data Transfer Objects
src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java
Renamed pagination field nextCursor to nextPage (Long → Integer) in PerformerPhotoAlbumDTO and ScrollMemberPhotoAlbumDTO; updated associated comments.
Repository Layer
src/main/java/cc/backend/photoAlbum/repository/PhotoAlbumRepository.java
Replaced cursor-based method findByPerformerWithCursor with page-based method findByPerformer; changed return type from List to Page; removed cursorId parameter and cursor-based WHERE clause; added Page import.
Service Layer
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java
Updated method signatures: getPhotoAlbumList now accepts page (int) instead of cursorId (Long); renamed getAllPhotoAlbumList to getAllRecentPhotoAlbumList with updated parameters (page, size).
Service Implementation
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
Refactored pagination logic from cursor-based to page-based using PageRequest/Pageable; replaced cursorId handling with page parameter construction; updated photoAlbumRepository.findByPerformer call; changed response field from nextCursor to nextPage derived from Page metadata; added consistent sorting by createdAt.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #108: Modifies photo album API surface (PhotoAlbumController, PhotoAlbumService, PhotoAlbumResponseDTO) to update image and presigned-URL DTO types used by the same controllers and services affected by this pagination refactoring.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template structure with placeholder text and no actual implementation details, related issues, or review requirements filled in. Fill in the template with specific details: reference any related issues, explain the pagination change from cursor to page-based approach, and note any breaking changes to public methods.
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.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[FIX] 사진첩 최신순, 페이지번호 기반 수정' clearly describes the main change: fixing photo album pagination from cursor-based to page-number-based, which matches the substantial refactoring across all modified files.
✨ Finishing touches
  • 📝 Docstrings were successfully generated.
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/photoAlbumPageNum

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

@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: 0

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/cc/backend/photoAlbum/repository/PhotoAlbumRepository.java (1)

33-34: Remove unused findNextAlbums method.

The findNextAlbums method implements cursor-based pagination and is not referenced anywhere in the codebase. After the refactoring to page-based pagination, this method is unused and should be removed.

🧹 Nitpick comments (2)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (2)

169-169: Consider clarifying the "number" field semantics.

The number field is set to singlePhotoAlbumDTOs.size(), which represents the count of items in the current page, not the total count across all pages. The field name could be ambiguous for API consumers. Consider renaming to pageSize or currentPageSize for clarity, or document its meaning explicitly.


144-144: Remove unnecessary blank line.

Minor style cleanup: the blank line at 144 can be removed.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f55b13a and c01d91f.

📒 Files selected for processing (5)
  • src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java
  • src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java
  • src/main/java/cc/backend/photoAlbum/repository/PhotoAlbumRepository.java
  • src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java
  • src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
🧰 Additional context used
🧬 Code graph analysis (3)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (2)
k6-tests/scripts/search-performance-test.js (2)
  • page (124-124)
  • size (125-125)
src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java (1)
  • PhotoAlbumResponseDTO (11-89)
src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java (1)
k6-tests/scripts/search-performance-test.js (2)
  • page (124-124)
  • size (125-125)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java (1)
k6-tests/scripts/search-performance-test.js (2)
  • page (124-124)
  • size (125-125)
🔇 Additional comments (7)
src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java (1)

62-62: LGTM! Field renames align with page-based pagination.

The DTO field renames from nextCursor to nextPage are consistent across both PerformerPhotoAlbumDTO and ScrollMemberPhotoAlbumDTO, properly supporting the pagination strategy change.

Also applies to: 84-84

src/main/java/cc/backend/photoAlbum/repository/PhotoAlbumRepository.java (1)

28-31: LGTM! Page-based query simplifies pagination logic.

The new findByPerformer method correctly returns Page<PhotoAlbum> and delegates ordering to the Pageable parameter, which is passed with Sort.by(Sort.Direction.DESC, "createdAt") from the service layer.

src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java (1)

16-16: LGTM! Service interface updated for page-based pagination.

The method signatures correctly reflect the migration from cursor-based to page-based pagination, accepting int page and int size parameters.

Also applies to: 19-19

src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java (2)

53-55: LGTM! Controller correctly implements page-based pagination.

The pagination parameters have been successfully migrated from cursor-based (Long cursorId) to page-based (int page) with appropriate defaults (defaultValue = "0"). The 0-indexed page numbering follows Spring Data's standard convention.

Also applies to: 79-81


42-42: Documentation clarification looks good.

The updated description clarifies that only keyName values from presigned URL calls should be passed in imageRequestDTOs. While unrelated to the pagination refactoring, this improves API documentation clarity.

src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (2)

118-173: LGTM! Page-based pagination implemented correctly.

The refactored getPhotoAlbumList method properly implements page-based pagination:

  • Uses PageRequest with descending createdAt sort for latest-first ordering (최신순)
  • Leverages Page<PhotoAlbum> for built-in pagination metadata
  • Maintains N+1 query prevention with batch image lookup
  • Correctly calculates nextPage based on hasNext()

284-323: LGTM! Consistent pagination implementation for recent albums.

The getAllRecentPhotoAlbumList method follows the same pattern as getPhotoAlbumList:

  • Consistent descending createdAt ordering
  • Uses Page for metadata
  • Maintains efficient batch image lookup
  • Proper nextPage calculation

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #122

@sweatbuckets sweatbuckets merged commit 94b74f6 into develop Dec 23, 2025
2 checks passed
coderabbitai bot added a commit that referenced this pull request Dec 23, 2025
Docstrings generation was requested by @sweatbuckets.

* #121 (comment)

The following files were modified:

* `src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java`
* `src/main/java/cc/backend/photoAlbum/repository/PhotoAlbumRepository.java`
* `src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java`
* `src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java`
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.

2 participants