-
Notifications
You must be signed in to change notification settings - Fork 1
[FIX] 사진첩 결과 dto에 이미지를 presignedUrl로 제공 #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR adds member authentication and presigned URL handling to photo album retrieval. The Changes
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
📒 Files selected for processing (5)
src/main/java/cc/backend/image/entity/Image.javasrc/main/java/cc/backend/image/service/ImageService.javasrc/main/java/cc/backend/photoAlbum/controller/PhotoAlbumController.javasrc/main/java/cc/backend/photoAlbum/service/PhotoAlbumService.javasrc/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
@AuthenticationPrincipalannotation 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
imageUrlis 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_AUTHORIZEDif 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:
- Fetching all cover images in a single query (line 300)
- Generating all presigned URLs in one batch operation (line 303)
- 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
coverImageDTOis null before accessing its presigned URL. This prevents potentialNullPointerExceptionand gracefully returnsnullfor theimageUrlfield 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
getAllRecentPhotoAlbumListmethod signature has been properly updated with thememberIdparameter in both the interface and the single implementation class (PhotoAlbumServiceImpl). The controller passes the member ID correctly viamember.getId(). No orphaned call sites or implementations with the old signature remain.
#이슈번호,#이슈번호Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.