Skip to content

Commit e76515e

Browse files
committed
merge: develop category feature
2 parents f6a0bce + 93633a8 commit e76515e

File tree

63 files changed

+1405
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1405
-120
lines changed

Projects/App/Project.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let project = Project(
88
),
99
settings: .settings(
1010
base: .init()
11-
.marketingVersion("2.0.4")
11+
.marketingVersion("2.1.0")
1212
.swiftVersion("5.7")
1313
.currentProjectVersion("1")
1414
.appleGenericVersioningSystem()
@@ -40,11 +40,11 @@ let project = Project(
4040
configurations: [
4141
.debug(name: "Debug", settings: [
4242
"CODE_SIGN_IDENTITY": "Apple Development: Nayeon Gu (3CMPGMMD7L)",
43-
"PROVISIONING_PROFILE_SPECIFIER": "match Development com.yapp.moneymong.WidgetExtension"
43+
"PROVISIONING_PROFILE_SPECIFIER": "match Development com.yapp.moneymong.WidgetExtension 1769511006"
4444
]),
4545
.release(name: "Release", settings: [
4646
"CODE_SIGN_IDENTITY": "Apple Distribution: Nayeon Gu (H5G7RFWFSQ)",
47-
"PROVISIONING_PROFILE_SPECIFIER": "match AppStore com.yapp.moneymong.WidgetExtension"
47+
"PROVISIONING_PROFILE_SPECIFIER": "match AppStore com.yapp.moneymong.WidgetExtension 1769511389"
4848
])
4949
]
5050
)
@@ -56,6 +56,7 @@ let project = Project(
5656
bundleId: "com.yapp.moneymong",
5757
deploymentTarget: .iOS(targetVersion: "15.0", devices: .iphone),
5858
infoPlist: .extendingDefault(with: [
59+
"UIDesignRequiresCompatibility": true,
5960
"CFBundleDisplayName": "머니몽",
6061
"UISupportedInterfaceOrientations": [
6162
"UIInterfaceOrientationPortrait"
@@ -117,11 +118,11 @@ let project = Project(
117118
configurations: [
118119
.debug(name: "Debug", settings: [
119120
"CODE_SIGN_IDENTITY": "Apple Development: Nayeon Gu (3CMPGMMD7L)",
120-
"PROVISIONING_PROFILE_SPECIFIER": "match Development com.yapp.moneymong"
121+
"PROVISIONING_PROFILE_SPECIFIER": "match Development com.yapp.moneymong 1769511003"
121122
]),
122123
.release(name: "Release", settings: [
123124
"CODE_SIGN_IDENTITY": "Apple Distribution: Nayeon Gu (H5G7RFWFSQ)",
124-
"PROVISIONING_PROFILE_SPECIFIER": "match AppStore com.yapp.moneymong"
125+
"PROVISIONING_PROFILE_SPECIFIER": "match AppStore com.yapp.moneymong 1769511386"
125126
])
126127
]
127128
),

Projects/App/Sources/SceneDelegate.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,21 @@ extension SceneDelegate {
185185
return ReissueCodeUseCase(repo: agencyRepo)
186186
}
187187

188+
DIContainer.shared.register(type: GetCategoriesUseCaseInterface.self) {
189+
let agencyRepo = AgencyRepository(networkManager: networkManager, localStorage: localStorage, memoryCache: memoryCache)
190+
return GetCategoriesUseCase(repo: agencyRepo)
191+
}
192+
193+
DIContainer.shared.register(type: DeleteCategoryUseCaseInterface.self) {
194+
let agencyRepo = AgencyRepository(networkManager: networkManager, localStorage: localStorage, memoryCache: memoryCache)
195+
return DeleteCategoryUseCase(repo: agencyRepo)
196+
}
197+
198+
DIContainer.shared.register(type: CreateCategoryUseCaseInterface.self) {
199+
let agencyRepo = AgencyRepository(networkManager: networkManager, localStorage: localStorage, memoryCache: memoryCache)
200+
return CreateCategoryUseCase(repo: agencyRepo)
201+
}
202+
188203
// MARK: - Ledger UseCase Dependency
189204
DIContainer.shared.register(type: CreateLedgerUseCaseInterface.self) {
190205
let ledgerRepo = LedgerRepository(networkManager: networkManager, localStorage: localStorage)

Projects/Core/MMNetwork/Sources/NetworkManager.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ public final class NetworkManager: NetworkManagerInterfacae {
2929
{
3030
if let message = errorResponse.message {
3131
throw MoneyMongError.appError(
32-
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default
32+
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default,
33+
errorMessage: message
3334
)
3435
}
3536

3637
if let messages = errorResponse.messages {
3738
throw MoneyMongError.appError(
38-
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default
39+
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default,
40+
errorMessage: messages.first
3941
)
4042
}
4143
}
@@ -96,13 +98,15 @@ public final class NetworkManager: NetworkManagerInterfacae {
9698
{
9799
if let message = errorResponse.message {
98100
throw MoneyMongError.appError(
99-
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default
101+
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default,
102+
errorMessage: message
100103
)
101104
}
102105

103106
if let messages = errorResponse.messages {
104107
throw MoneyMongError.appError(
105-
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default
108+
MoneyMongError.Code(rawValue: errorResponse.code) ?? .default,
109+
errorMessage: messages.first
106110
)
107111
}
108112
}

Projects/Core/Repository/Sources/APIs/AgencyAPI/Repository/AgencyAPI.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ enum AgencyAPI {
1212
case certificateCode(param: InvitationCodeCertificationRequestDTO) // 초대코드 인증
1313
case reissueCode(id: Int) // 초대코드 재발급
1414
case delete(id: Int) // 소속삭제
15+
case getCategories(id: Int)
16+
case createCategory(query: CreateCategoryRequestDTO)
17+
case deleteCategory(id: Int)
1518
}
1619

1720
extension AgencyAPI: TargetType {
@@ -30,6 +33,7 @@ extension AgencyAPI: TargetType {
3033
case .certificateCode: return "v2/agencies/invitation-code"
3134
case let .reissueCode(id): return "v1/agencies/\(id)/invitation-code"
3235
case let .delete(id): return "v1/agencies/\(id)"
36+
case .getCategories, .createCategory, .deleteCategory: return "v1/agencies/categories"
3337
}
3438
}
3539

@@ -44,6 +48,9 @@ extension AgencyAPI: TargetType {
4448
case .certificateCode: return .post
4549
case .reissueCode: return .patch
4650
case .delete: return .delete
51+
case .getCategories: return .get
52+
case .createCategory: return .post
53+
case .deleteCategory: return .delete
4754
}
4855
}
4956

@@ -58,6 +65,9 @@ extension AgencyAPI: TargetType {
5865
case let .certificateCode(param): return .requestJSONEncodable(params: param)
5966
case .reissueCode: return .plain
6067
case .delete: return .plain
68+
case let .getCategories(id): return .requestJSONEncodable(query: ["agencyId":id])
69+
case let .createCategory(params): return .requestJSONEncodable(params: params)
70+
case let .deleteCategory(id): return .requestJSONEncodable(params: ["categoryId":id])
6171
}
6272
}
6373

Projects/Core/Repository/Sources/APIs/AgencyAPI/Repository/AgencyRepository.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,19 @@ public struct AgencyRepository: AgencyRepositoryInterface {
100100
localStorage.deleteCurrentLedgerInfo()
101101
memoryCache.delete(key: "v1/agencies/me")
102102
}
103+
104+
public func getCategories(id: Int) async throws -> [MMCategory] {
105+
let targetType = AgencyAPI.getCategories(id: id)
106+
return try await networkManager.request(target: targetType, of: CategoriesResponseDTO.self).toEntity
107+
}
108+
109+
public func createCategory(agencyId: Int, name: String) async throws {
110+
let targetType = AgencyAPI.createCategory(query: CreateCategoryRequestDTO(agencyId: agencyId, name: name))
111+
try await networkManager.request(target: targetType)
112+
}
113+
114+
public func deleteCategory(id: Int) async throws {
115+
let targetType = AgencyAPI.deleteCategory(id: id)
116+
try await networkManager.request(target: targetType)
117+
}
103118
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Foundation
2+
3+
struct CreateCategoryRequestDTO: Encodable {
4+
let agencyId: Int
5+
let name: String
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Foundation
2+
3+
import BaseDomain
4+
import MMNetworkInterface
5+
6+
struct CategoriesResponseDTO: Responsable {
7+
let agencyId: Int
8+
let categories: [CategoryResponseDTO]
9+
10+
var toEntity: [MMCategory] { categories.map(\.toEntity) }
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Foundation
2+
3+
import BaseDomain
4+
import MMNetworkInterface
5+
6+
struct CategoryResponseDTO: Responsable {
7+
let id: Int
8+
let name: String
9+
10+
var toEntity: MMCategory {
11+
return MMCategory(id: id, name: name)
12+
}
13+
}

Projects/Core/Repository/Sources/APIs/LedgerAPI/Repository/LedgerRepository.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public final class LedgerRepository: LedgerRepositoryInterface {
2424
amount: Int,
2525
description: String,
2626
paymentDate: String,
27-
documentImageUrls: [String]
27+
documentImageUrls: [String],
28+
category: String?
2829
) async throws {
2930
let targetType = LedgerAPI.create(
3031
id: id,
@@ -34,7 +35,8 @@ public final class LedgerRepository: LedgerRepositoryInterface {
3435
amount: amount,
3536
description: description,
3637
paymentDate: paymentDate,
37-
documentImageUrls: documentImageUrls
38+
documentImageUrls: documentImageUrls,
39+
category: category
3840
)
3941
)
4042
let ledger = try await networkManager.request(target: targetType, of: LedgerDetailResponseDTO.self)
@@ -63,7 +65,8 @@ public final class LedgerRepository: LedgerRepositoryInterface {
6365
amount: ledger.amount,
6466
description: ledger.description,
6567
paymentDate: ledger.paymentDate,
66-
documentImageUrls: ledger.documentImageUrls.map { $0.url }
68+
documentImageUrls: ledger.documentImageUrls.map { $0.url },
69+
category: ledger.category
6770
)
6871
)
6972
let entity = try await networkManager.request(target: targetType, of: LedgerDetailResponseDTO.self).toEntity

Projects/Core/Repository/Sources/APIs/LedgerAPI/RequestDTO/LedgerRequestDTO.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ struct LedgerRequestDTO: Encodable {
88
let paymentDate: String
99
let receiptImageUrls: [String] = []
1010
let documentImageUrls: [String]
11+
let category: String?
1112
}

0 commit comments

Comments
 (0)