Skip to content

Commit 867c1ed

Browse files
authored
[#467] Persistence 레이어에서 Domain 레이어 의존성을 제거한다 (#472)
* chore: Infra 레이어에서 복구된 Domain 레이어 의존성 제거 * chore: ActivityKind를 Core 레이어로 이동 * refactor: 위젯 스냅샷 데이터 모델 분리 * chore: Persistence 레이어에서 Domain 의존 제거 * fix: 위젯 스냅샷 갱신 기준 시점 통일
1 parent 45c7a3a commit 867c1ed

20 files changed

Lines changed: 109 additions & 97 deletions

File tree

Application/DevLogDomain/Sources/Entity/ActivityKind.swift renamed to Application/DevLogCore/Sources/ActivityKind.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// ActivityKind.swift
3-
// DevLogDomain
3+
// DevLogCore
44
//
55
// Created by opfic on 4/4/26.
66
//

Application/DevLogData/Sources/DTO/TodoDTO.swift

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77

88
import Foundation
9-
import DevLogDomain
109

1110
public struct TodoRequest: Encodable {
1211
public let id: String
@@ -102,3 +101,34 @@ public struct TodoResponse {
102101
self.category = category
103102
}
104103
}
104+
105+
public struct WidgetTodoSnapshot: Equatable {
106+
public let id: String
107+
public let number: Int?
108+
public let title: String
109+
public let isPinned: Bool
110+
public let createdAt: Date
111+
public let completedAt: Date?
112+
public let deletedAt: Date?
113+
public let dueDate: Date?
114+
115+
public init(
116+
id: String,
117+
number: Int?,
118+
title: String,
119+
isPinned: Bool,
120+
createdAt: Date,
121+
completedAt: Date?,
122+
deletedAt: Date?,
123+
dueDate: Date?
124+
) {
125+
self.id = id
126+
self.number = number
127+
self.title = title
128+
self.isPinned = isPinned
129+
self.createdAt = createdAt
130+
self.completedAt = completedAt
131+
self.deletedAt = deletedAt
132+
self.dueDate = dueDate
133+
}
134+
}

Application/DevLogData/Sources/Mapper/TodoMapping.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ public extension TodoResponse {
5757
}
5858
}
5959

60+
public extension WidgetTodoSnapshot {
61+
static func fromDomain(_ todo: Todo) -> Self {
62+
WidgetTodoSnapshot(
63+
id: todo.id,
64+
number: todo.number,
65+
title: todo.title,
66+
isPinned: todo.isPinned,
67+
createdAt: todo.createdAt,
68+
completedAt: todo.completedAt,
69+
deletedAt: todo.deletedAt,
70+
dueDate: todo.dueDate
71+
)
72+
}
73+
}
74+
6075
public extension TodoCursorDTO {
6176
func toDomain() -> TodoCursor {
6277
TodoCursor(

Application/DevLogData/Sources/Protocol/WidgetSnapshotPreferenceStore.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import Foundation
99
import DevLogCore
10-
import DevLogDomain
1110

1211
public protocol WidgetSnapshotPreferenceStore {
1312
func heatmapActivityTypes() -> [String]

Application/DevLogData/Sources/Protocol/WidgetSnapshotUpdater.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,21 @@
77

88
import Foundation
99
import DevLogCore
10-
import DevLogDomain
1110

1211
public protocol WidgetSnapshotUpdater {
1312
func updateTodaySnapshot(
14-
todos: [Todo],
13+
todos: [WidgetTodoSnapshot],
1514
now: Date
1615
)
1716
func updateTodaySnapshot(
18-
todos: [Todo],
17+
todos: [WidgetTodoSnapshot],
1918
displayOptions: TodayDisplayOptions,
2019
now: Date
2120
)
2221
func updateHeatmapSnapshot(
23-
createdTodos: [Todo],
24-
completedTodos: [Todo],
25-
deletedTodos: [Todo],
22+
createdTodos: [WidgetTodoSnapshot],
23+
completedTodos: [WidgetTodoSnapshot],
24+
deletedTodos: [WidgetTodoSnapshot],
2625
quarterStart: Date,
2726
now: Date
2827
)

Application/DevLogInfra/DevLogInfra.xcodeproj/project.pbxproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
5F7A14F2C5294547884212E1 /* FirebaseCore in Frameworks */ = {isa = PBXBuildFile; productRef = 06ADD17826F44543B09286DA /* FirebaseCore */; };
1212
65623F19F34A9A75BC72EE36 /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = CE8F32B22E13743B3FF3B66B /* FirebaseFirestore */; };
1313
B11111111111111111111111 /* DevLogCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B55555555555555555555555 /* DevLogCore.framework */; };
14-
E06504AD71E9A40ACCA85ABB /* DevLogDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A93F27C7172C85CD7252AA /* DevLogDomain.framework */; };
1514
E747320CAD03A579976E87F8 /* FirebaseFunctions in Frameworks */ = {isa = PBXBuildFile; productRef = 172AF9DE3BC54E9E0B4EFD19 /* FirebaseFunctions */; };
1615
EE62AAD289D9CED31CC9E05D /* GoogleSignIn in Frameworks */ = {isa = PBXBuildFile; productRef = 7333E70E9D312E56D4A364A6 /* GoogleSignIn */; };
1716
F085DED20E80F63AE071D8BA /* DevLogData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4F874032FD57C0BBCC41C64 /* DevLogData.framework */; };
@@ -84,7 +83,6 @@
8483
EE62AAD289D9CED31CC9E05D /* GoogleSignIn in Frameworks */,
8584
FEBF252AD70A910C914D3D22 /* Nexa in Frameworks */,
8685
F085DED20E80F63AE071D8BA /* DevLogData.framework in Frameworks */,
87-
E06504AD71E9A40ACCA85ABB /* DevLogDomain.framework in Frameworks */,
8886
B11111111111111111111111 /* DevLogCore.framework in Frameworks */,
8987
);
9088
runOnlyForDeploymentPostprocessing = 0;
@@ -177,7 +175,6 @@
177175
buildRules = (
178176
);
179177
dependencies = (
180-
1F4AAA000000000000000001 /* PBXTargetDependency */,
181178
);
182179
fileSystemSynchronizedGroups = (
183180
959D79D1263CC74E32B40D78 /* Sources */,
@@ -271,10 +268,6 @@
271268
/* End PBXSourcesBuildPhase section */
272269

273270
/* Begin PBXTargetDependency section */
274-
1F4AAA000000000000000001 /* PBXTargetDependency */ = {
275-
isa = PBXTargetDependency;
276-
productRef = 1F4AAA000000000000000003 /* SwiftLintBuildToolPlugin */;
277-
};
278271
1F4AAA000000000000000004 /* PBXTargetDependency */ = {
279272
isa = PBXTargetDependency;
280273
productRef = 1F4AAA000000000000000003 /* SwiftLintBuildToolPlugin */;

Application/DevLogPersistence/DevLogPersistence.xcodeproj/project.pbxproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
4763564ECF9942DCB6A7D3D2 /* DevLogWidgetCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FF5E1613F059A4B77931161 /* DevLogWidgetCore.framework */; };
1313
4EE7A141A66C408EB8897D4A /* DevLogPersistence.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E8AA2A43914F444BF5A6C2 /* DevLogPersistence.framework */; };
1414
5F89EB23199E4ABEA925CF92 /* DevLogData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 493A5D0B4274807F2B948AB3 /* DevLogData.framework */; };
15-
7D8DE74BD24B456D42B04806 /* DevLogDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F334BCFC52C730D5901F6051 /* DevLogDomain.framework */; };
16-
8A95AB09613C4F54883A7A38 /* DevLogDomain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F334BCFC52C730D5901F6051 /* DevLogDomain.framework */; };
1715
A11111111111111111111111 /* DevLogCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A55555555555555555555555 /* DevLogCore.framework */; };
1816
E53E13B73BFAF0C51013ECA2 /* DevLogWidgetCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FF5E1613F059A4B77931161 /* DevLogWidgetCore.framework */; };
1917
F47DBE7D3E7E49F08D4B5530 /* DevLogCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A55555555555555555555555 /* DevLogCore.framework */; };
@@ -36,7 +34,6 @@
3634
86E8AA2A43914F444BF5A6C2 /* DevLogPersistence.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DevLogPersistence.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3735
98B16FCDA8A71E2E4E1DC05E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
3836
A55555555555555555555555 /* DevLogCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DevLogCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
39-
F334BCFC52C730D5901F6051 /* DevLogDomain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DevLogDomain.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4037
/* End PBXFileReference section */
4138

4239
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
@@ -68,7 +65,6 @@
6865
files = (
6966
4EE7A141A66C408EB8897D4A /* DevLogPersistence.framework in Frameworks */,
7067
F47DBE7D3E7E49F08D4B5530 /* DevLogCore.framework in Frameworks */,
71-
8A95AB09613C4F54883A7A38 /* DevLogDomain.framework in Frameworks */,
7268
5F89EB23199E4ABEA925CF92 /* DevLogData.framework in Frameworks */,
7369
4763564ECF9942DCB6A7D3D2 /* DevLogWidgetCore.framework in Frameworks */,
7470
);
@@ -79,7 +75,6 @@
7975
buildActionMask = 2147483647;
8076
files = (
8177
041CEED3822FCBD881DF75CD /* Foundation.framework in Frameworks */,
82-
7D8DE74BD24B456D42B04806 /* DevLogDomain.framework in Frameworks */,
8378
E53E13B73BFAF0C51013ECA2 /* DevLogWidgetCore.framework in Frameworks */,
8479
3B8FAEC025F373D4CFC262D4 /* DevLogData.framework in Frameworks */,
8580
A11111111111111111111111 /* DevLogCore.framework in Frameworks */,
@@ -120,7 +115,6 @@
120115
children = (
121116
86E8AA2A43914F444BF5A6C2 /* DevLogPersistence.framework */,
122117
62B066C5B0714BC3B5F4D9D0 /* DevLogPersistenceTests.xctest */,
123-
F334BCFC52C730D5901F6051 /* DevLogDomain.framework */,
124118
5FF5E1613F059A4B77931161 /* DevLogWidgetCore.framework */,
125119
493A5D0B4274807F2B948AB3 /* DevLogData.framework */,
126120
A55555555555555555555555 /* DevLogCore.framework */,

Application/DevLogPersistence/Sources/Persistence/WidgetSnapshotPreferenceStoreImpl.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import Foundation
99
import DevLogCore
1010
import DevLogData
11-
import DevLogDomain
1211

1312
final class WidgetSnapshotPreferenceStoreImpl: WidgetSnapshotPreferenceStore {
1413
private enum Key: String, CaseIterable {

Application/DevLogPersistence/Sources/Persistence/WidgetSnapshotUpdaterImpl.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import Foundation
99
import WidgetKit
1010
import DevLogCore
11-
import DevLogDomain
1211
import DevLogData
1312
import DevLogWidgetCore
1413

@@ -32,7 +31,7 @@ final class WidgetSnapshotUpdaterImpl: WidgetSnapshotUpdater {
3231
}
3332

3433
func updateTodaySnapshot(
35-
todos: [Todo],
34+
todos: [WidgetTodoSnapshot],
3635
now: Date = Date()
3736
) {
3837
updateTodaySnapshot(
@@ -43,7 +42,7 @@ final class WidgetSnapshotUpdaterImpl: WidgetSnapshotUpdater {
4342
}
4443

4544
func updateTodaySnapshot(
46-
todos: [Todo],
45+
todos: [WidgetTodoSnapshot],
4746
displayOptions: TodayDisplayOptions,
4847
now: Date = Date()
4948
) {
@@ -65,9 +64,9 @@ final class WidgetSnapshotUpdaterImpl: WidgetSnapshotUpdater {
6564
}
6665

6766
func updateHeatmapSnapshot(
68-
createdTodos: [Todo],
69-
completedTodos: [Todo],
70-
deletedTodos: [Todo],
67+
createdTodos: [WidgetTodoSnapshot],
68+
completedTodos: [WidgetTodoSnapshot],
69+
deletedTodos: [WidgetTodoSnapshot],
7170
quarterStart: Date,
7271
now: Date = Date()
7372
) {

Application/DevLogPersistence/Tests/Persistence/WidgetSnapshotPreferenceStoreTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
import Foundation
9-
import DevLogDomain
9+
import DevLogCore
1010
import Testing
1111
@testable import DevLogPersistence
1212

0 commit comments

Comments
 (0)