Skip to content

Conversation

@zyovn
Copy link
Member

@zyovn zyovn commented Nov 26, 2025

🔗 연관된 이슈

🚀 변경 유형

  • ✨ 기능 추가 (feature)
  • 🐛 버그 수정 (fix)
  • 📝 문서 변경 (docs)
  • ♻️ 리팩토링 (refactor)
  • 🧪 테스트 추가 / 수정 (test)
  • ⚙️ 설정 변경 (chore)

📝 작업 내용

  • 사진 1시간 다운로드 여부 오류 수정
  • 사진 목록 조회에 업로더 프로필 이미지 추가

📸 스크린샷

11시에 다운받았을 때,,
image

9시에 다운받았을 때,,
스크린샷 2025-11-26 231016

사진 목록 조회에 프로필 이미지 추가
image

💬 리뷰 요구사항

📜 리뷰 규칙

Reviewer는 아래 P5 Rule을 참고하여 리뷰를 진행합니다.
P5 Rule을 통해 Reviewer는 Reviewee에게 리뷰의 의도를 보다 정확히 전달할 수 있습니다.

  • P1: 꼭 반영해주세요 (Comment)
  • P2: 적극적으로 고려해주세요 (Comment)
  • P3: 웬만하면 반영해 주세요 (Comment)
  • P4: 반영해도 좋고 넘어가도 좋습니다 (Approve)
  • P5: 그냥 사소한 의견입니다 (Approve)
  • 허거덩

Summary by CodeRabbit

변경사항

  • 새로운 기능

    • 사진 목록 응답에 profileImage 필드 추가 — API 응답에서 각 사진의 사용자 프로필 이미지가 제공됩니다.
    • 사진 상세, 목록 및 좋아요 사용자 목록에서 프로필 이미지가 함께 표시됩니다.
  • 개선사항

    • 최근 다운로드 판정 기준을 생성 시간(created)에서 수정 시간(updated)으로 변경해 최신 활동을 더 정확히 반영합니다.

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

@zyovn zyovn self-assigned this Nov 26, 2025
@zyovn zyovn added the 🐛bug Something isn't working label Nov 26, 2025
@zyovn zyovn linked an issue Nov 26, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Nov 26, 2025

Walkthrough

프로필 이미지 해석을 ProfileImageUtil.resolveProfileImage(...)로 통합하고, 반환 DTO에 profileImage 필드를 추가해 매퍼 시그니처를 갱신했습니다. 또한 최근 다운로드 판정 기준을 createdAt에서 updatedAt로 변경했습니다. (메서드 시그니처 공개 변경 없음)

Changes

응집 / 파일(s) 변경 요약
프로필 이미지 해석 통합
\src/main/java/com/cheeeese/photo/application/PhotoInfoService.java`, `src/main/java/com/cheeeese/photo/application/PhotoQueryService.java``
per-user 프로필 이미지 해석을 ProfileImageUtil.resolveProfileImage(user, cdnUrlResolver)로 대체하고, 매퍼 호출에 profileImage 값을 전달하도록 변경 (기존 ProfileImageType/URL 직접 계산 제거)
응답 DTO 및 매퍼 인터페이스 변경
\src/main/java/com/cheeeese/photo/dto/response/PhotoListResponse.java`, `src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java``
PhotoListResponse 레코드에 profileImage 컴포넌트 및 스키마 추가. PhotoMapper.toPhotoListResponse(...) 시그니처에 profileImage 매개변수 추가 및 응답에 설정
저장소 쿼리/메서드명 변경
\src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java``
existsByUserIdAndPhotoIdAndCreatedAtAfter(...)existsByUserIdAndPhotoIdAndUpdatedAtAfter(...)로 메서드명 변경 및 쿼리에서 ph.createdAtph.updatedAt로 조건 전환

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[]
Loading

Estimated code review effort

🎯 3 (보통) | ⏱️ ~20분

  • 검토 주의점:
    • PhotoMapper.toPhotoListResponse 호출자 전체의 시그니처 일관성 확인
    • ProfileImageUtil.resolveProfileImage의 null/예외 처리 경로 점검
    • PhotoHistoryRepositoryupdatedAt 기준 변경이 비즈니스 의도와 일치하는지 확인

Possibly related PRs

Suggested labels

✨feature

Suggested reviewers

  • dahyun24

Poem

🐇 새빨간 당근 대신 문자열 한 줄,
프로필을 꿰맨 내 작은 발자국.
매퍼 손에 쥐어주니 반짝이고,
타임스탬프는 살짝 뒤로 깜박,
치즈빛 서비스에 폴짝 — 깡총 ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 부분을 정확히 반영합니다. 1시간 다운로드 여부 오류 수정이 핵심 변경사항이며, 프로필 이미지 추가도 포함되어 있습니다.
✨ 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/#101-recently-download

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a92e12 and 5b1bd69.

📒 Files selected for processing (1)
  • src/main/java/com/cheeeese/photo/application/PhotoInfoService.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/cheeeese/photo/application/PhotoInfoService.java

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

📥 Commits

Reviewing files that changed from the base of the PR and between bbbf86a and c4d0655.

📒 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.java
  • src/main/java/com/cheeeese/photo/application/PhotoInfoService.java
  • src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java
  • src/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.java
  • src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoHistoryRepository.java
  • src/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.java
  • src/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)에서도 올바르게 사용되고 있습니다.

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/com/cheeeese/photo/application/PhotoInfoService.java (1)

17-17: 사용하지 않는 import를 제거하세요.

ProfileImageUtil로 리팩토링한 후 ProfileImageType import가 더 이상 사용되지 않는 것으로 보입니다.

다음 diff를 적용하여 import를 제거하세요:

-import com.cheeeese.user.domain.type.ProfileImageType;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb6e84a and 8a92e12.

📒 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() 사용 문제가 해결되어, 각 좋아요 사용자가 자신의 프로필 이미지를 표시하게 됩니다.

Copy link
Contributor

@dahyun24 dahyun24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔫

수고하셨어유~~

@zyovn zyovn merged commit 33eb158 into develop Nov 27, 2025
1 check passed
@zyovn zyovn deleted the fix/#101-recently-download branch November 27, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 사진 1시간 다운로드 여부 오류

3 participants