-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Photo, UserAlbum 엔티티에 Join 추가 및 NewEnterResponse 수정 #36
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도메인 엔티티의 원시 외래키(userId, albumId)를 JPA 관계(User, Album)로 리팩토링하고, 최근 사진 응답을 업로더 정보가 포함된 DTO(List)로 변경하며 매퍼·리포지토리·서비스 호출을 이에 맞춰 조정했습니다. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant AlbumService
participant PhotoService
participant PhotoRepository
participant AlbumMapper
participant UserAlbumMapper
User->>AlbumService: enterAlbum(token, currentUser)
AlbumService->>PhotoService: getRecentPhotosForNewEnter(albumId)
PhotoService->>PhotoRepository: findRecentPhotosByAlbumIdAndStatus(albumId, ACTIVE, PageRequest)
PhotoRepository-->>PhotoService: List<Photo>
PhotoService-->>AlbumService: List<Photo>
AlbumService->>AlbumMapper: toRecentPhotoResponse(Photo) *map*
AlbumMapper-->>AlbumService: List<RecentPhotoResponse>
AlbumService->>UserAlbumMapper: toEntity(currentUser, album, Role.GUEST/MAKER)
UserAlbumMapper-->>AlbumService: UserAlbum
AlbumService-->>User: NewEnterResponse(recentPhotos: List<RecentPhotoResponse>, ...)
sequenceDiagram
participant Before as 이전 흐름
participant After as 변경된 흐름
Before->>Before: Photo(userId: Long, albumId: Long)
After->>After: Photo(user: User, album: Album)
Before->>Before: PhotoMapper.toEntity(Long userId, Long albumId)
After->>After: PhotoMapper.toEntity(User user, Album album)
Before->>Before: recentPhotoUrls: List<String>
After->>After: recentPhotos: List<RecentPhotoResponse>
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related issues
Possibly related PRs
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 (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-31T13:17:52.512ZApplied to files:
🧬 Code graph analysis (1)src/main/java/com/cheeeese/album/application/AlbumService.java (2)
🔇 Additional comments (4)
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: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/main/java/com/cheeeese/album/application/AlbumService.java(5 hunks)src/main/java/com/cheeeese/album/domain/UserAlbum.java(3 hunks)src/main/java/com/cheeeese/album/dto/response/NewEnterResponse.java(2 hunks)src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java(3 hunks)src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java(1 hunks)src/main/java/com/cheeeese/album/infrastructure/persistence/UserAlbumRepository.java(1 hunks)src/main/java/com/cheeeese/photo/application/PhotoService.java(3 hunks)src/main/java/com/cheeeese/photo/application/validator/PhotoValidator.java(2 hunks)src/main/java/com/cheeeese/photo/domain/Photo.java(3 hunks)src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java(1 hunks)src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoRepository.java(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-31T13:17:52.512Z
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.512Z
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/album/dto/response/NewEnterResponse.javasrc/main/java/com/cheeeese/album/application/AlbumService.javasrc/main/java/com/cheeeese/photo/application/PhotoService.javasrc/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.javasrc/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoRepository.java
🧬 Code graph analysis (2)
src/main/java/com/cheeeese/album/application/AlbumService.java (2)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (1)
AlbumMapper(13-149)src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
UserAlbumMapper(8-18)
src/main/java/com/cheeeese/photo/application/PhotoService.java (1)
src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
PhotoMapper(12-42)
🔇 Additional comments (5)
src/main/java/com/cheeeese/album/infrastructure/persistence/UserAlbumRepository.java (1)
13-20: JPQL로 엔티티 기반 조회를 명시한 점이 깔끔합니다.src/main/java/com/cheeeese/photo/application/validator/PhotoValidator.java (1)
106-119: 엔티티 참조를 활용한 검증으로 일관성이 확보된 것 확인했습니다.src/main/java/com/cheeeese/photo/infrastructure/mapper/PhotoMapper.java (1)
14-22: User·Album 엔티티를 직접 세팅하도록 바꾼 구성 잘 반영되었습니다.src/main/java/com/cheeeese/album/application/AlbumService.java (1)
161-177: 최근 사진 응답이 기획 요구(1~4장일 때 1장, 5장일 때 5장)를 그대로 유지하고 있어요.Based on learnings
src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
10-16: 엔티티 참조 기반 빌더 구성이 일관되게 정리되었습니다.
src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoRepository.java
Show resolved
Hide resolved
zyovn
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.
🔗 연관된 이슈
🚀 변경 유형
📝 작업 내용
📸 스크린샷
💬 리뷰 요구사항
Summary by CodeRabbit
새로운 기능
리팩터