-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 앨범 참여 로직 수정 #35
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
fix: 앨범 참여 로직 수정 #35
Conversation
- 최근 5장의 썸네일 이미지와 함께 response 되어야하는 업로드 사용자 닉네임, image url 을 제외한 구현 - joinStatus에 따른 3가지 response 분리
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (5)
Tip CodeRabbit can generate a title for your PR based on the changes.Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the Walkthrough앨범 도메인에서 호스트 중심 모델을 제작자 중심 모델로 리팩토링하고, 앨범 입장 흐름을 다단계 분기 로직으로 개선했습니다. 사용자 앨범 가시성 관리와 신규/기존/복구 참여 상태 구분이 추가되었으며, 응답 구조를 sealed interface 기반 다형으로 변경했습니다. Changes
Sequence Diagram(s)sequenceDiagram
actor User as 사용자
participant AlbumService as AlbumService
participant AlbumRepository as AlbumRepository
participant UserAlbumRepository as UserAlbumRepository
participant PhotoService as PhotoService
participant AlbumValidator as AlbumValidator
participant AlbumMapper as AlbumMapper
User->>AlbumService: enterAlbum(albumCode, userId)
AlbumService->>AlbumRepository: findByCode(albumCode)
AlbumRepository-->>AlbumService: Album
AlbumService->>AlbumValidator: validateAlbumExpiration(album)
rect rgb(200, 150, 255)
Note over AlbumService: 만료 확인 단계
alt 만료됨
AlbumService-->>User: ExpiredInvitationResponse(RESTORED)
else 만료 안됨
AlbumService->>AlbumValidator: validateAlbumCapacity(album)
end
end
rect rgb(150, 200, 255)
Note over AlbumService: 참여 상태 확인 단계
AlbumService->>UserAlbumRepository: findByUserIdAndAlbumId(userId, albumId)
alt 기존 참여 기록 있음
rect rgb(200, 255, 200)
Note over AlbumService: 복구 흐름
UserAlbumRepository-->>AlbumService: UserAlbum(isVisible=false)
AlbumService->>UserAlbumRepository: show() 호출
AlbumService-->>User: ExistingEnterResponse(RESTORED)
end
else 기존 참여 기록 없음
rect rgb(200, 255, 200)
Note over AlbumService: 신규 흐름
AlbumService->>UserAlbumRepository: 새 UserAlbum 생성 및 저장
AlbumService->>AlbumRepository: 참여자 수 증가
AlbumService->>PhotoService: getRecentThumbnailUrls(albumId)
PhotoService-->>AlbumService: 썸네일 URL 리스트
AlbumService->>AlbumMapper: toNewResponse(album, makerInfo, slots, urls)
AlbumMapper-->>AlbumService: NewEnterResponse
AlbumService-->>User: NewEnterResponse(NEW)
end
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 분 추가 검토 필요 영역:
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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: 3
🧹 Nitpick comments (1)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (1)
5-5: 명시적 import 사용을 고려해보세요.와일드카드 import (
import com.cheeeese.album.dto.response.*)는 어떤 클래스들이 실제로 사용되는지 파악하기 어렵게 만들고, 네이밍 충돌 가능성을 높입니다. 명시적 import를 사용하면 코드 가독성과 유지보수성이 향상됩니다.예시:
-import com.cheeeese.album.dto.response.*; +import com.cheeeese.album.dto.response.AlbumCreationResponse; +import com.cheeeese.album.dto.response.AlbumInvitationResponse; +import com.cheeeese.album.dto.response.AlbumMakerInfo; +import com.cheeeese.album.dto.response.ExistingEnterResponse; +import com.cheeeese.album.dto.response.NewEnterResponse; +import com.cheeeese.album.dto.response.UploadAvailableCountResponse;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
src/main/java/com/cheeeese/album/application/AlbumService.java(5 hunks)src/main/java/com/cheeeese/album/application/validator/AlbumValidator.java(2 hunks)src/main/java/com/cheeeese/album/domain/Album.java(3 hunks)src/main/java/com/cheeeese/album/domain/UserAlbum.java(1 hunks)src/main/java/com/cheeeese/album/domain/type/AlbumJoinStatus.java(1 hunks)src/main/java/com/cheeeese/album/dto/response/AlbumEnterResponse.java(1 hunks)src/main/java/com/cheeeese/album/dto/response/AlbumInvitationResponse.java(1 hunks)src/main/java/com/cheeeese/album/dto/response/AlbumMakerInfo.java(1 hunks)src/main/java/com/cheeeese/album/dto/response/ExistingEnterResponse.java(1 hunks)src/main/java/com/cheeeese/album/dto/response/NewEnterResponse.java(1 hunks)src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java(4 hunks)src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java(2 hunks)src/main/java/com/cheeeese/album/infrastructure/persistence/AlbumRepository.java(2 hunks)src/main/java/com/cheeeese/album/presentation/swagger/AlbumSwagger.java(1 hunks)src/main/java/com/cheeeese/photo/application/PhotoService.java(1 hunks)src/main/java/com/cheeeese/photo/infrastructure/persistence/PhotoRepository.java(1 hunks)src/test/java/com/cheeeese/album/integration/UserAlbumServiceIntegrationTest.java(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/test/java/com/cheeeese/album/integration/UserAlbumServiceIntegrationTest.java (1)
src/test/java/com/cheeeese/fixture/FixtureFactory.java (2)
FixtureFactory(14-65)createHostUserAlbum(58-64)
src/main/java/com/cheeeese/album/domain/type/AlbumJoinStatus.java (3)
src/main/java/com/cheeeese/photo/domain/PhotoStatus.java (1)
PhotoStatus(3-8)src/main/java/com/cheeeese/album/domain/type/Role.java (1)
Role(3-7)src/main/java/com/cheeeese/photo/domain/Photo.java (1)
Entity(12-72)
src/main/java/com/cheeeese/album/application/AlbumService.java (2)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (1)
AlbumMapper(12-138)src/main/java/com/cheeeese/album/infrastructure/mapper/UserAlbumMapper.java (1)
UserAlbumMapper(8-30)
🔇 Additional comments (5)
src/main/java/com/cheeeese/album/infrastructure/mapper/AlbumMapper.java (5)
17-43: 호스트 → 제작자 모델 전환이 잘 적용되었습니다.
hostId에서makerId로의 파라미터 및 필드 변경이 일관되게 적용되어 있으며, 로직상 문제가 없습니다.
61-71: isExpired 필드 추가가 적절합니다.활성 초대장에 대해
isExpired(false)를 설정하는 것이 의도대로 구현되었습니다.
73-86: 만료된 앨범에 대한 응답 처리가 명확합니다.만료된 앨범의 경우 호스트 정보를
null로 설정하고isExpired(true)를 반환하는 로직이 명확하게 구현되었습니다. 만료 시 호스트 정보를 노출하지 않는 것이 의도된 동작으로 보입니다.
88-97: 기존 참여자에 대한 응답 매핑이 잘 구현되었습니다.
ExistingEnterResponse생성 로직이 명확하며,AlbumJoinStatus와AlbumMakerInfo를 포함한 응답 구조가 적절합니다.
99-115: 신규 참여자 응답 매핑이 일관되게 수정되었습니다.호스트 → 제작자 용어 변경이 일관되게 적용되었으며,
joinStatus를 명시적으로NEW로 설정하여 코드 명확성이 향상되었습니다.
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.
수고하셨습니다! 🎸🧀
코드가 많이 바뀌엇네요.. 짱
🔗 연관된 이슈
🚀 변경 유형
📝 작업 내용
isExpired필드 추가isVisible필드 추가 (나에게만 삭제 기능을 위해서)NEW: 앨범 정보와 함께 썸네일 이미지 제공isVisible이true인 경우EXISTING: (추후) 앨범 상세 페이지로 이동isVisible이false인 경우RESTORED:isVisible = true로 바꿔준 후 (추후) 마이페이지로 이동📸 스크린샷
isExpired필드 추가NEWEXISTINGRESTORED💬 리뷰 요구사항
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선 사항