Skip to content

Conversation

@sweatbuckets
Copy link
Contributor

@sweatbuckets sweatbuckets commented Dec 23, 2025

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

Summary by CodeRabbit

  • New Features
    • Photo album retrieval now requires user authentication, delivering personalized results based on the authenticated user.
    • Enhanced image delivery mechanism for photo albums with improved access controls.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Walkthrough

The PR adds member authentication and presigned URL handling to photo album retrieval. The getAllRecentPhotoAlbumList method now requires a memberId parameter, validates the member exists, and retrieves presigned URLs for album images through batch processing via the image service instead of per-album retrieval.

Changes

Cohort / File(s) Summary
Comment and documentation updates
src/main/java/cc/backend/image/entity/Image.java, src/main/java/cc/backend/image/service/ImageService.java
Updated user-facing comment on imageUrl field to reflect static-content-specific usage; added Korean comment line above login authorization check in getImages.
Photo album controller API update
src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java
Modified getAllPhotoAlbum to accept authenticated Member parameter and pass member.getId() to service method call.
Photo album service signature update
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.java
Updated getAllRecentPhotoAlbumList signature to add Long memberId as first parameter.
Photo album service implementation refactor
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java
Added member authentication validation; replaced per-album image retrieval with batch image fetching via imageService.getImages(images, memberId) to obtain presigned URLs; introduced contentId-to-ImageResultWithPresignedUrlDTO mapping for DTO construction.

Sequence Diagram

sequenceDiagram
    participant Client
    participant PhotoAlbumController
    participant PhotoAlbumServiceImpl
    participant ImageService
    participant Database

    Client->>PhotoAlbumController: GET getAllPhotoAlbum(Member, page, size)
    PhotoAlbumController->>PhotoAlbumServiceImpl: getAllRecentPhotoAlbumList(memberId, page, size)
    
    rect rgb(200, 220, 240)
        Note over PhotoAlbumServiceImpl: Member Authentication
        PhotoAlbumServiceImpl->>Database: Load member by memberId
        Database-->>PhotoAlbumServiceImpl: Member or null
        alt Member not found
            PhotoAlbumServiceImpl-->>PhotoAlbumController: MEMBER_NOT_AUTHORIZED exception
        end
    end
    
    rect rgb(220, 240, 220)
        Note over PhotoAlbumServiceImpl: Fetch photo albums
        PhotoAlbumServiceImpl->>Database: Query recent photo albums (page, size)
        Database-->>PhotoAlbumServiceImpl: List of PhotoAlbum entities
    end
    
    rect rgb(240, 220, 220)
        Note over PhotoAlbumServiceImpl,ImageService: Batch Presigned URL Processing
        PhotoAlbumServiceImpl->>ImageService: getImages(images, memberId)
        ImageService->>Database: Fetch images by contentId
        Database-->>ImageService: Image entities
        ImageService-->>PhotoAlbumServiceImpl: ImageResultWithPresignedUrlDTO list
        PhotoAlbumServiceImpl->>PhotoAlbumServiceImpl: Map contentId → ImageResultWithPresignedUrlDTO
    end
    
    PhotoAlbumServiceImpl->>PhotoAlbumServiceImpl: Build PhotoAlbumResponseDTO with presigned URLs
    PhotoAlbumServiceImpl-->>PhotoAlbumController: ScrollMemberPhotoAlbumDTO
    PhotoAlbumController-->>Client: JSON response with presigned URLs
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only the template placeholders with no actual content filled in; no related issues, work explanation, or review requests were provided. Replace template placeholders with actual details: specify related issue number(s), explain the work performed (presigned URL implementation), and add any relevant review requests.
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 clearly describes the main change: providing presigned URLs for images in photo album result DTOs, which aligns with the actual code modifications.
✨ 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/PhotoAlbumGetUrl

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

🧹 Nitpick comments (1)
src/main/java/cc/backend/image/service/ImageService.java (1)

130-130: Consider using English for code comments.

The Korean comment "//로그인 검사" (login check) may reduce code readability for international contributors. Consider using English consistently throughout the codebase.

🔎 Suggested alternative
-        //로그인 검사
+        // Member authorization check
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94b74f6 and 8bce9ad.

📒 Files selected for processing (5)
  • src/main/java/cc/backend/image/entity/Image.java
  • src/main/java/cc/backend/image/service/ImageService.java
  • src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.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/image/entity/Image.java (3)
src/main/java/cc/backend/amateurShow/entity/AmateurShow.java (1)
  • updatePosterImageUrl (148-150)
src/main/java/cc/backend/amateurShow/entity/AmateurNotice.java (1)
  • Entity (11-41)
src/main/java/cc/backend/amateurShow/entity/AmateurCasting.java (1)
  • updateCastingImageKeyName (40-42)
src/main/java/cc/backend/photoAlbum/service/PhotoAlbumServiceImpl.java (2)
src/main/java/cc/backend/image/DTO/ImageResponseDTO.java (1)
  • ImageResponseDTO (11-38)
src/main/java/cc/backend/photoAlbum/dto/PhotoAlbumResponseDTO.java (1)
  • PhotoAlbumResponseDTO (11-89)
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 (6)
src/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.java (1)

79-84: LGTM! Member authentication properly added.

The controller correctly passes the authenticated member's ID to the service layer, consistent with other endpoints in this controller. The @AuthenticationPrincipal annotation ensures proper authentication before the method executes.

src/main/java/cc/backend/image/entity/Image.java (1)

35-35: Good documentation clarification.

The updated comment clearly distinguishes that imageUrl is reserved for static content (poster, notice, actor images), while presigned URLs for photo albums are generated dynamically via the service layer. This aligns well with the PR's objective to use presigned URLs for photo album images.

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

284-288: LGTM! Member authentication properly implemented.

The method now validates that the member exists before proceeding, throwing MEMBER_NOT_AUTHORIZED if not found. This aligns with security best practices and is consistent with other methods in this service.


295-307: Excellent performance optimization with batch processing!

The refactored code eliminates the N+1 query problem by:

  1. Fetching all cover images in a single query (line 300)
  2. Generating all presigned URLs in one batch operation (line 303)
  3. Using a map for O(1) lookup per album (lines 306-307)

This is a significant improvement over the previous per-album approach and will scale much better with larger result sets.


309-320: Proper null handling for missing cover images.

The code correctly handles albums without cover images by checking if coverImageDTO is null before accessing its presigned URL. This prevents potential NullPointerException and gracefully returns null for the imageUrl field when no cover image exists.

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

19-19: Interface change correctly implemented across all implementations.

The getAllRecentPhotoAlbumList method signature has been properly updated with the memberId parameter in both the interface and the single implementation class (PhotoAlbumServiceImpl). The controller passes the member ID correctly via member.getId(). No orphaned call sites or implementations with the old signature remain.

@sweatbuckets sweatbuckets merged commit 9ff9454 into develop Dec 23, 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.

2 participants