Conversation
#Conflicts: # Neki-iOS/Features/Archive/Sources/Presentation/Sources/Feature/AlbumSelectionFeature.swift # Neki-iOS/Features/Archive/Sources/Presentation/Sources/Feature/PhotoImportFeature.swift
요약사진 복제 및 이동 기능을 위한 새로운 API 엔드포인트 및 비즈니스 로직이 추가되었습니다. 네트워크 계층부터 프레젠테이션 계층까지 변경 사항
시퀀스 다이어그램sequenceDiagram
actor User
participant Presentation as AlbumSelectionFeature
participant Client as ArchiveClient
participant Repository as DefaultArchiveRepository
participant Network as NetworkProvider
User->>Presentation: 확인 버튼 탭 (목적: duplicate/move)
activate Presentation
alt Purpose == .duplicate
Presentation->>Client: duplicatePhoto(photoIDs, targetFolderIDs)
activate Client
Client->>Repository: duplicatePhoto(photoIDs, targetFolderIDs)
activate Repository
Repository->>Network: request(.duplicatePhoto(request))
activate Network
Network-->>Repository: 성공
deactivate Network
Repository->>Repository: isAlbumCacheDirty = true<br/>targetFolderIDs 캐시 무효화
Repository-->>Client: void
deactivate Repository
Client-->>Presentation: void
deactivate Client
Presentation->>Presentation: .taskCompleted(복제 성공 메시지)
else Purpose == .move
Presentation->>Client: movePhoto(sourceFolderId, photoIDs, targetFolderIDs)
activate Client
Client->>Repository: movePhoto(sourceFolderId, photoIDs, targetFolderIDs)
activate Repository
Repository->>Network: request(.movePhoto(request))
activate Network
Network-->>Repository: 성공
deactivate Network
Repository->>Repository: isAlbumCacheDirty = true<br/>sourceFolderId + targetFolderIDs 캐시 무효화
Repository-->>Client: void
deactivate Repository
Client-->>Presentation: void
deactivate Client
Presentation->>Presentation: .taskCompleted(이동 성공 메시지)
end
deactivate Presentation
예상 코드 리뷰 노력🎯 3 (보통) | ⏱️ ~20분 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (2)
Neki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swift (1)
327-345:movePhoto후favoritePhotoCache정합성 고려사진 이동 시
favoritePhotoCache에 캐시된PhotoEntity의folderID가 이전 폴더 ID를 유지할 수 있습니다. 즐겨찾기된 사진이 이동될 경우 캐시 불일치가 발생할 수 있습니다.♻️ 캐시 무효화 추가 제안
func movePhoto(sourceFolderId: Int, photoIDs: [Int], targetFolderIDs: [Int]) async throws { let request = UpdateMappingPhotoDTO.MovePhotos( sourceFolderID: sourceFolderId, photoIDS: photoIDs, targetFolderIDS: targetFolderIDs ) let endpoint = ArchiveEndpoint.movePhoto(request: request) let _ = try await networkProvider.request(endpoint: endpoint) // 앨범 정보 캐시 갱신 self.isAlbumCacheDirty = true self.isPhotoCacheDirty[sourceFolderId] = true // Target 폴더(혹은 전체 사진) 캐시 갱신 for targetID in targetFolderIDs { self.isPhotoCacheDirty[targetID] = true } + + // 즐겨찾기 캐시에 이동된 사진이 있을 경우 대비 + self.isFavoriteCacheDirty = true }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Neki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swift` around lines 327 - 345, movePhoto currently invalidates album/photo caches but doesn’t reconcile favoritePhotoCache, which can leave PhotoEntity.folderID stale; inside movePhoto (function movePhoto) either update favoritePhotoCache entries for each moved photoID (find entries in favoritePhotoCache whose id is in photoIDs and set their folderID to the new target folderID when there is a single target) or, if multiple/ambiguous targets, remove/invalidate those favoritePhotoCache entries (or set a favorite cache dirty flag like isFavoriteCacheDirty) so the favorites reload; reference favoritePhotoCache, PhotoEntity.folderID, photoIDs and targetFolderIDs and apply the chosen fix right after marking isPhotoCacheDirty so favorites remain consistent.Neki-iOS/Features/Archive/Sources/Data/Sources/DTO/UpdateMappingPhotoDTO.swift (1)
11-29: 명명 규칙 고려:IDS→IDsSwift 명명 규칙에서 약어는 전부 대문자 또는 전부 소문자로 표기하는 것이 일반적입니다.
photoIDS와targetFolderIDS보다는photoIDs와targetFolderIDs가 더 Swift 관용적입니다.♻️ 제안된 수정
public struct MovePhotos: Encodable { let sourceFolderID: Int - let photoIDS, targetFolderIDS: [Int] + let photoIDs, targetFolderIDs: [Int] enum CodingKeys: String, CodingKey { case sourceFolderID = "sourceFolderId" - case photoIDS = "photoIds" - case targetFolderIDS = "targetFolderIds" + case photoIDs = "photoIds" + case targetFolderIDs = "targetFolderIds" } } public struct DuplicatePhotos: Encodable { - let photoIDS, targetFolderIDS: [Int] + let photoIDs, targetFolderIDs: [Int] enum CodingKeys: String, CodingKey { - case photoIDS = "photoIds" - case targetFolderIDS = "targetFolderIds" + case photoIDs = "photoIds" + case targetFolderIDs = "targetFolderIds" } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Neki-iOS/Features/Archive/Sources/Data/Sources/DTO/UpdateMappingPhotoDTO.swift` around lines 11 - 29, Rename the properties to follow Swift idioms by changing photoIDS → photoIDs, targetFolderIDS → targetFolderIDs, and sourceFolderID → sourceFolderId in the MovePhotos and DuplicatePhotos structs (and update their CodingKeys cases to still map to "photoIds", "targetFolderIds", "sourceFolderId"); then update all usages/imports of MovePhotos, DuplicatePhotos, photoIDS, targetFolderIDS, and sourceFolderID throughout the codebase to the new names.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@Neki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swift`:
- Around line 327-345: movePhoto currently invalidates album/photo caches but
doesn’t reconcile favoritePhotoCache, which can leave PhotoEntity.folderID
stale; inside movePhoto (function movePhoto) either update favoritePhotoCache
entries for each moved photoID (find entries in favoritePhotoCache whose id is
in photoIDs and set their folderID to the new target folderID when there is a
single target) or, if multiple/ambiguous targets, remove/invalidate those
favoritePhotoCache entries (or set a favorite cache dirty flag like
isFavoriteCacheDirty) so the favorites reload; reference favoritePhotoCache,
PhotoEntity.folderID, photoIDs and targetFolderIDs and apply the chosen fix
right after marking isPhotoCacheDirty so favorites remain consistent.
In
`@Neki-iOS/Features/Archive/Sources/Data/Sources/DTO/UpdateMappingPhotoDTO.swift`:
- Around line 11-29: Rename the properties to follow Swift idioms by changing
photoIDS → photoIDs, targetFolderIDS → targetFolderIDs, and sourceFolderID →
sourceFolderId in the MovePhotos and DuplicatePhotos structs (and update their
CodingKeys cases to still map to "photoIds", "targetFolderIds",
"sourceFolderId"); then update all usages/imports of MovePhotos,
DuplicatePhotos, photoIDS, targetFolderIDS, and sourceFolderID throughout the
codebase to the new names.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c141b88d-bc5a-4c23-81b5-82d1ae1b05fe
📒 Files selected for processing (8)
Neki-iOS/Features/Archive/Sources/Data/Sources/ArchiveEndpoint.swiftNeki-iOS/Features/Archive/Sources/Data/Sources/DTO/UpdateMappingPhotoDTO.swiftNeki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swiftNeki-iOS/Features/Archive/Sources/Domain/Sources/Client/ArchiveClient.swiftNeki-iOS/Features/Archive/Sources/Domain/Sources/Interfaces/Repositories/ArchiveRepository.swiftNeki-iOS/Features/Archive/Sources/Presentation/Sources/Feature/AlbumSelectionFeature.swiftNeki-iOS/Features/Archive/Sources/Presentation/Sources/Feature/PhotoImportFeature.swiftNeki-iOS/Features/Archive/Sources/Presentation/Sources/View/ArchiveAlbumDetailView.swift
Remaked-Swain
left a comment
There was a problem hiding this comment.
특이사항 없어보입니다! LGTM
라인별 코멘트만 확인해주세용
그리고 API 나오기 이전 스프린트3, 4에 대한 피드백도 차차 고려해봐주세요.
| public enum UpdateMappingPhotoDTO { | ||
| public struct MovePhotos: Encodable { | ||
| let sourceFolderID: Int | ||
| let photoIDS, targetFolderIDS: [Int] | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case sourceFolderID = "sourceFolderId" | ||
| case photoIDS = "photoIds" | ||
| case targetFolderIDS = "targetFolderIds" | ||
| } | ||
| } | ||
|
|
||
| public struct DuplicatePhotos: Encodable { | ||
| let photoIDS, targetFolderIDS: [Int] | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case photoIDS = "photoIds" | ||
| case targetFolderIDS = "targetFolderIds" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
p2)
팀 내 컨벤션에 따르면 식별자의 복수형에 대하여 ID는 대문자로, 뒤의 s는 소문자로 작성되어야 합니다.
| if purpose == .duplicate { | ||
| // 복제 - sourceFolderId 없음 | ||
| try await archiveClient.duplicatePhoto(photoIDs: photoIDs, targetFolderIDs: targetFolderIDs) | ||
| await send(.taskCompleted(message: "사진을 앨범에 추가했어요")) | ||
|
|
||
| } else if purpose == .move { | ||
| // 이동 - sourceFolderId 필수 | ||
| if let sourceFolderId = currentAlbumId { | ||
| try await archiveClient.movePhoto(sourceFolderId: sourceFolderId, photoIDs: photoIDs, targetFolderIDs: targetFolderIDs) | ||
| await send(.taskCompleted(message: "사진을 앨범으로 이동했어요")) | ||
| } else { | ||
| await send(.taskFailed(message: "사진 이동에 실패했어요")) | ||
| } | ||
| } |
There was a problem hiding this comment.
p3)
switch 문으로 바꾸면 연산횟수가 줄어들 수 있을까요?
🌴 작업한 브랜치
network/#206-sprint4-api✅ 작업한 내용
📟 관련 이슈
Summary by CodeRabbit
새로운 기능
개선사항