Skip to content

Commit fe461ae

Browse files
committed
[Chore] #206 - 변경된 dto 반영
1 parent 6fe3e0e commit fe461ae

6 files changed

Lines changed: 45 additions & 47 deletions

File tree

Neki-iOS/Features/Archive/Sources/Data/Sources/ArchiveEndpoint.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public enum ArchiveEndpoint {
2020
case excludePhotosInAlbum(albumID: Int, request: DeletePhotoRequestDTO)
2121
case editFolderName(albumID: Int, request: FolderDTO.Request)
2222
case updateMemo(photoID: Int, request: UpdateMemoRequestDTO)
23-
case duplicatePhoto(request: UpdateMappingPhotoRequestDTO)
24-
case movePhoto(request: UpdateMappingPhotoRequestDTO)
23+
case duplicatePhoto(request: UpdateMappingPhotoDTO.DuplicatePhotos)
24+
case movePhoto(request: UpdateMappingPhotoDTO.MovePhotos)
2525
}
2626

2727
extension ArchiveEndpoint: Endpoint {

Neki-iOS/Features/Archive/Sources/Data/Sources/DTO/Request/UpdateMappingPhotoRequestDTO.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// UpdateMappingPhotoDTO.swift
3+
// Neki-iOS
4+
//
5+
// Created by OneTen on 4/12/26.
6+
//
7+
8+
import Foundation
9+
10+
public enum UpdateMappingPhotoDTO {
11+
public struct MovePhotos: Encodable {
12+
let sourceFolderID: Int
13+
let photoIDS, targetFolderIDS: [Int]
14+
15+
enum CodingKeys: String, CodingKey {
16+
case sourceFolderID = "sourceFolderId"
17+
case photoIDS = "photoIds"
18+
case targetFolderIDS = "targetFolderIds"
19+
}
20+
}
21+
22+
public struct DuplicatePhotos: Encodable {
23+
let photoIDS, targetFolderIDS: [Int]
24+
25+
enum CodingKeys: String, CodingKey {
26+
case photoIDS = "photoIds"
27+
case targetFolderIDS = "targetFolderIds"
28+
}
29+
}
30+
}

Neki-iOS/Features/Archive/Sources/Data/Sources/DefaultArchiveRepository.swift

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,8 @@ extension DefaultArchiveRepository {
307307

308308
}
309309

310-
func duplicatePhoto(sourceFolderId: Int?, photoIDs: [Int], targetFolderIDs: [Int]) async throws {
311-
let request = UpdateMappingPhotoRequestDTO(
312-
sourceFolderID: sourceFolderId,
310+
func duplicatePhoto(photoIDs: [Int], targetFolderIDs: [Int]) async throws {
311+
let request = UpdateMappingPhotoDTO.DuplicatePhotos(
313312
photoIDS: photoIDs,
314313
targetFolderIDS: targetFolderIDs
315314
)
@@ -325,8 +324,8 @@ extension DefaultArchiveRepository {
325324
}
326325
}
327326

328-
func movePhoto(sourceFolderId: Int?, photoIDs: [Int], targetFolderIDs: [Int]) async throws {
329-
let request = UpdateMappingPhotoRequestDTO(
327+
func movePhoto(sourceFolderId: Int, photoIDs: [Int], targetFolderIDs: [Int]) async throws {
328+
let request = UpdateMappingPhotoDTO.MovePhotos(
330329
sourceFolderID: sourceFolderId,
331330
photoIDS: photoIDs,
332331
targetFolderIDS: targetFolderIDs
@@ -337,23 +336,11 @@ extension DefaultArchiveRepository {
337336
// 앨범 정보 캐시 갱신
338337
self.isAlbumCacheDirty = true
339338

340-
// Source 폴더(혹은 전체 사진) 캐시 갱신
341-
if let sourceID = sourceFolderId {
342-
if var list = photoCache[sourceID] {
343-
list.removeAll { photoIDs.contains($0.photoID) }
344-
photoCache[sourceID] = list
345-
}
346-
} else {
347-
self.isPhotoCacheDirty[nil] = true
348-
}
339+
self.isPhotoCacheDirty[sourceFolderId] = true
349340

350341
// Target 폴더(혹은 전체 사진) 캐시 갱신
351-
if targetFolderIDs.isEmpty {
352-
self.isPhotoCacheDirty[nil] = true
353-
} else {
354-
for targetID in targetFolderIDs {
355-
self.isPhotoCacheDirty[targetID] = true
356-
}
342+
for targetID in targetFolderIDs {
343+
self.isPhotoCacheDirty[targetID] = true
357344
}
358345
}
359346

Neki-iOS/Features/Archive/Sources/Domain/Sources/Client/ArchiveClient.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ struct ArchiveClient {
2424
public var editAlbumName: (_ albumID: Int, _ name: String) async throws -> Void
2525
public var updatePhotoMemo: (_ photoID: Int, _ memo: String) async throws -> Void
2626
public var clearCache: () async -> Void
27-
public var duplicatePhoto: (_ sourceFolderId: Int?, _ photoIDs: [Int], _ targetFolderIDs: [Int]) async throws -> Void
28-
public var movePhoto: (_ sourceFolderId: Int?, _ photoIDs: [Int], _ targetFolderIDs: [Int]) async throws -> Void
27+
public var duplicatePhoto: (_ photoIDs: [Int], _ targetFolderIDs: [Int]) async throws -> Void
28+
public var movePhoto: (_ sourceFolderId: Int, _ photoIDs: [Int], _ targetFolderIDs: [Int]) async throws -> Void
2929
}
3030

3131
extension ArchiveClient: DependencyKey {
@@ -72,8 +72,8 @@ extension ArchiveClient: DependencyKey {
7272
clearCache: {
7373
await archiveRepository.clearCache()
7474
},
75-
duplicatePhoto: { sourceFolderId, photoIDs, targetFolderIDs in
76-
try await archiveRepository.duplicatePhoto(sourceFolderId: sourceFolderId, photoIDs: photoIDs, targetFolderIDs: targetFolderIDs)
75+
duplicatePhoto: { photoIDs, targetFolderIDs in
76+
try await archiveRepository.duplicatePhoto(photoIDs: photoIDs, targetFolderIDs: targetFolderIDs)
7777
},
7878
movePhoto: { sourceFolderId, photoIDs, targetFolderIDs in
7979
try await archiveRepository.movePhoto(sourceFolderId: sourceFolderId, photoIDs: photoIDs, targetFolderIDs: targetFolderIDs)

Neki-iOS/Features/Archive/Sources/Domain/Sources/Interfaces/Repositories/ArchiveRepository.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ protocol ArchiveRepository: Sendable {
2323
func excludePhotosInAlbum(albumID: Int, photoIDs: [Int]) async throws
2424
func editAlbumName(albumID: Int, name: String) async throws
2525
func updatePhotoMemo(photoID: Int, memo: String) async throws
26-
func duplicatePhoto(sourceFolderId: Int?, photoIDs: [Int], targetFolderIDs: [Int]) async throws
27-
func movePhoto(sourceFolderId: Int?, photoIDs: [Int], targetFolderIDs: [Int]) async throws
26+
func duplicatePhoto(photoIDs: [Int], targetFolderIDs: [Int]) async throws
27+
func movePhoto(sourceFolderId: Int, photoIDs: [Int], targetFolderIDs: [Int]) async throws
2828

2929
// Delete
3030
func deletePhotoList(photoIDs: [Int]) async throws

0 commit comments

Comments
 (0)