-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 사진 1시간 다운로드 여부 오류 #102
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
Walkthrough프로필 이미지 해석을 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant PhotoQueryService as PQS
participant PhotoInfoService as PIS
participant ProfileImageUtil as PIU
participant PhotoMapper as PM
participant Repo
Client->>PQS: 사진 목록/페이지 요청
PQS->>Repo: Photo 조회
Repo-->>PQS: Photo 객체들
loop per photo
PQS->>PIU: resolveProfileImage(photo.user, cdnUrlResolver)
PIU-->>PQS: profileImage (String)
PQS->>PM: toPhotoListResponse(photo, profileImage, imageUrl, thumbnailUrl, isLiked, isDownloaded)
PM-->>PQS: PhotoListResponse
end
PQS-->>Client: PhotoListResponse[]
Estimated code review effort🎯 3 (보통) | ⏱️ ~20분
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 1
🧹 Nitpick comments (1)
src/main/java/com/cheeeese/photo/dto/response/PhotoListResponse.java (1)
26-26: API 문서화를 위해 @Schema 어노테이션 추가를 권장합니다.다른 필드들(name, photoId, imageUrl 등)과 달리
profileImage필드에@Schema어노테이션이 누락되어 있습니다. 일관성과 Swagger 문서 품질을 위해 추가하는 것이 좋습니다.다음 diff를 적용하여 @Schema 어노테이션을 추가하세요:
+ @Schema(description = "사진 업로더 프로필 이미지", example = "profile/default.jpg") String profileImage,
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java(2 hunks)src/main/java/com/cheeeese/photo/application/PhotoQueryService.java(2 hunks)src/main/java/com/cheeeese/photo/dto/response/PhotoListResponse.java(2 hunks)src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java(2 hunks)src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-31T13:17:52.523Z
Learnt from: dahyun24
Repo: Say-Cheeeese/BE PR: 35
File: src/main/java/com/cheeeese/photo/application/PhotoService.java:46-52
Timestamp: 2025-10-31T13:17:52.523Z
Learning: In src/main/java/com/cheeeese/photo/application/PhotoService.java, the getRecentThumbnailUrls method intentionally returns only the first thumbnail URL when photos.size() < 5, rather than returning all available thumbnails. This is according to product requirements: 0 photos → empty list, 1-4 photos → single thumbnail (most recent), 5 photos → all 5 thumbnails.
Applied to files:
src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.javasrc/main/java/com/cheeeese/photo/application/PhotoInfoService.javasrc/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.javasrc/main/java/com/cheeeese/photo/application/PhotoQueryService.java
📚 Learning: 2025-11-13T12:56:22.161Z
Learnt from: dahyun24
Repo: Say-Cheeeese/BE PR: 58
File: src/main/java/com/cheeeese/cheese4cut/application/Cheese4cutService.java:149-156
Timestamp: 2025-11-13T12:56:22.161Z
Learning: In src/main/java/com/cheeeese/cheese4cut/application/Cheese4cutService.java, the finalizeCheese4cut method intentionally re-sorts photos using findAllByIdInOrderByLikesDescCreatedDesc(request.photoIds()) instead of preserving the client's requested order. This is a defensive measure to ensure photos are always ordered by likes (DESC) and creation time (DESC), regardless of what order the client sends, preventing incorrect ordering from client errors.
Applied to files:
src/main/java/com/cheeeese/photo/application/PhotoInfoService.javasrc/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.javasrc/main/java/com/cheeeese/photo/application/PhotoQueryService.java
📚 Learning: 2025-11-05T03:06:41.855Z
Learnt from: zyovn
Repo: Say-Cheeeese/BE PR: 44
File: src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java:36-36
Timestamp: 2025-11-05T03:06:41.855Z
Learning: PhotoHistoryRepository의 existsByUserIdAndPhotoIdAndCreatedAt 메서드는 정확한 타임스탬프 일치를 확인하는 시그니처로, "1시간 이내 다운로드" 체크에는 부적합합니다. Spring Data JPA에서는 existsByUserIdAndPhotoIdAndCreatedAtAfter를 사용하여 >= 비교를 수행해야 합니다.
Applied to files:
src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.javasrc/main/java/com/cheeeese/photo/application/PhotoQueryService.java
🧬 Code graph analysis (2)
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java (2)
src/main/java/com/cheeeese/global/util/ProfileImageUtil.java (1)
ProfileImageUtil(7-14)src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
PhotoMapper(15-180)
src/main/java/com/cheeeese/photo/application/PhotoQueryService.java (2)
src/main/java/com/cheeeese/global/util/ProfileImageUtil.java (1)
ProfileImageUtil(7-14)src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
PhotoMapper(15-180)
🔇 Additional comments (4)
src/main/java/com/cheeeese/photo/application/PhotoQueryService.java (2)
104-106: updatedAt 기반 최근 다운로드 체크로 변경 - 검증이 필요합니다.
createdAt에서updatedAt으로 변경한 것은 "1시간 이내 다운로드" 로직에 적합합니다. 이는 첫 다운로드 시점이 아닌 가장 최근 다운로드 시점을 확인하는 것이 맞습니다.다음 사항을 확인해주세요:
PhotoHistory엔티티에서 다운로드가 재발생할 때updatedAt필드가 자동으로 갱신되는지 검증이 필요합니다. JPA@LastModifiedDate또는 수동 업데이트 로직이 제대로 동작하는지 확인하세요.Based on learnings, 이전 PR에서
CreatedAtAfter로는 정확한 비교가 불가능하다는 피드백이 있었으며, 이번 변경이 그 문제를 해결합니다.
119-126: LGTM - 프로필 이미지 통합이 올바르게 구현되었습니다.사진 목록에 업로더의 프로필 이미지를 추가하는 로직이 정확하게 구현되었습니다.
ProfileImageUtil을 사용하여photo.getUser()의 프로필 이미지를 해상도하고 매퍼에 전달하는 흐름이 적절합니다.src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java (1)
16-16: LGTM - 최근 다운로드 체크 로직이 일관되게 업데이트되었습니다.메서드명과 쿼리 모두
updatedAt기반으로 일관되게 변경되었습니다. 이는 "1시간 이내 다운로드" 체크를 가장 최근 다운로드 시점 기준으로 정확하게 수행할 수 있도록 합니다.Based on learnings, 이전에 지적되었던
CreatedAtAfter의 부적합성 문제가UpdatedAtAfter로 해결되었습니다.Also applies to: 26-37
src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
66-84: LGTM - 매퍼 시그니처 업데이트가 올바르게 구현되었습니다.
toPhotoListResponse메서드에profileImage파라미터가 추가되고 빌더를 통해 올바르게 전달됩니다. 이는PhotoListResponse의 새 필드와 일치하며, 호출 지점(PhotoQueryService)에서도 올바르게 사용되고 있습니다.
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/com/cheeeese/photo/application/PhotoInfoService.java (1)
17-17: 사용하지 않는 import를 제거하세요.
ProfileImageUtil로 리팩토링한 후ProfileImageTypeimport가 더 이상 사용되지 않는 것으로 보입니다.다음 diff를 적용하여 import를 제거하세요:
-import com.cheeeese.user.domain.type.ProfileImageType;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: zyovn
Repo: Say-Cheeeese/BE PR: 44
File: src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java:36-36
Timestamp: 2025-11-05T03:06:41.855Z
Learning: PhotoHistoryRepository의 existsByUserIdAndPhotoIdAndCreatedAt 메서드는 정확한 타임스탬프 일치를 확인하는 시그니처로, "1시간 이내 다운로드" 체크에는 부적합합니다. Spring Data JPA에서는 existsByUserIdAndPhotoIdAndCreatedAtAfter를 사용하여 >= 비교를 수행해야 합니다.
📚 Learning: 2025-11-13T12:56:22.161Z
Learnt from: dahyun24
Repo: Say-Cheeeese/BE PR: 58
File: src/main/java/com/cheeeese/cheese4cut/application/Cheese4cutService.java:149-156
Timestamp: 2025-11-13T12:56:22.161Z
Learning: In src/main/java/com/cheeeese/cheese4cut/application/Cheese4cutService.java, the finalizeCheese4cut method intentionally re-sorts photos using findAllByIdInOrderByLikesDescCreatedDesc(request.photoIds()) instead of preserving the client's requested order. This is a defensive measure to ensure photos are always ordered by likes (DESC) and creation time (DESC), regardless of what order the client sends, preventing incorrect ordering from client errors.
Applied to files:
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java
📚 Learning: 2025-10-31T13:17:52.523Z
Learnt from: dahyun24
Repo: Say-Cheeeese/BE PR: 35
File: src/main/java/com/cheeeese/photo/application/PhotoService.java:46-52
Timestamp: 2025-10-31T13:17:52.523Z
Learning: In src/main/java/com/cheeeese/photo/application/PhotoService.java, the getRecentThumbnailUrls method intentionally returns only the first thumbnail URL when photos.size() < 5, rather than returning all available thumbnails. This is according to product requirements: 0 photos → empty list, 1-4 photos → single thumbnail (most recent), 5 photos → all 5 thumbnails.
Applied to files:
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java
🧬 Code graph analysis (1)
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java (2)
src/main/java/com/cheeeese/global/util/ProfileImageUtil.java (1)
ProfileImageUtil(7-14)src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
PhotoMapper(15-180)
🔇 Additional comments (1)
src/main/java/com/cheeeese/photo/application/PhotoInfoService.java (1)
44-52: 이전 크리티컬 이슈가 수정되었습니다! 🎉Line 46이 이제
liker의 프로필 이미지를 올바르게 해상도하고 있습니다. 이전에 지적되었던photo.getUser()사용 문제가 해결되어, 각 좋아요 사용자가 자신의 프로필 이미지를 표시하게 됩니다.
dahyun24
left a 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.
LGTM 🔫
수고하셨어유~~
🔗 연관된 이슈
🚀 변경 유형
📝 작업 내용
📸 스크린샷
💬 리뷰 요구사항
📜 리뷰 규칙
Reviewer는 아래 P5 Rule을 참고하여 리뷰를 진행합니다.
P5 Rule을 통해 Reviewer는 Reviewee에게 리뷰의 의도를 보다 정확히 전달할 수 있습니다.
Summary by CodeRabbit
변경사항
새로운 기능
개선사항
✏️ Tip: You can customize this high-level summary in your review settings.