Skip to content

Commit 9474351

Browse files
committed
[fix] 즐겨찾기 카테고리 수정
- isFavorite field 추가로 인한 DTO, Domain 수정
1 parent a6659fd commit 9474351

File tree

16 files changed

+60
-31
lines changed

16 files changed

+60
-31
lines changed

Projects/App/Sources/MainTab/MainTabPath.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ public extension MainTabFeature {
245245
createdAt: "",
246246
openType: .공개,
247247
keywordType: .default,
248-
userCount: 0
248+
userCount: 0,
249+
isFavorite: false
249250
)
250251
state.path.append(.포킷추가및수정(PokitCategorySettingFeature.State(
251252
type: .공유추가,

Projects/CoreKit/Sources/Data/DTO/Category/CategoryListInquiryResponse.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public struct CategoryItemInquiryResponse: Decodable {
2828
public let openType: String
2929
public let keywordType: String
3030
public let userCount: Int
31+
public let isFavorite: Bool
3132
}
3233
/// Sort
3334
public struct ItemInquirySortResponse: Decodable {
@@ -51,7 +52,8 @@ public extension CategoryItemInquiryResponse {
5152
createdAt: "",
5253
openType: "PRIVATE",
5354
keywordType: "스포츠/레저",
54-
userCount: 0
55+
userCount: 0,
56+
isFavorite: false
5557
)
5658
}
5759

@@ -70,7 +72,8 @@ extension CategoryListInquiryResponse {
7072
createdAt: "",
7173
openType: "PRIVATE",
7274
keywordType: "스포츠/레저",
73-
userCount: 0
75+
userCount: 0,
76+
isFavorite: false
7477
),
7578
CategoryItemInquiryResponse(
7679
categoryId: 2,
@@ -84,7 +87,8 @@ extension CategoryListInquiryResponse {
8487
createdAt: "",
8588
openType: "PUBLIC",
8689
keywordType: "스포츠/레저",
87-
userCount: 1
90+
userCount: 1,
91+
isFavorite: false
8892
),
8993
CategoryItemInquiryResponse(
9094
categoryId: 3,
@@ -98,7 +102,8 @@ extension CategoryListInquiryResponse {
98102
createdAt: "",
99103
openType: "PUBLIC",
100104
keywordType: "스포츠/레저",
101-
userCount: 5
105+
userCount: 5,
106+
isFavorite: false
102107
)
103108
],
104109
page: 1,

Projects/CoreKit/Sources/Data/Network/Category/CategoryClient+LiveKey.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ extension CategoryClient: DependencyKey {
2121
카테고리_수정: { id, model in
2222
try await provider.request(.카테고리_수정(categoryId: id, model: model))
2323
},
24-
카테고리_목록_조회: { model, categoryFilter in
25-
try await provider.request(.카테고리_목록_조회(model: model, filterUncategorized: categoryFilter))
24+
카테고리_목록_조회: { model, categoryFilter, favoriteFilter in
25+
try await provider.request(
26+
.카테고리_목록_조회(
27+
model: model,
28+
filterUncategorized: categoryFilter,
29+
filterFavoriteCategorized: favoriteFilter
30+
)
31+
)
2632
},
2733
카테고리_생성: { model in
2834
try await provider.request(.카테고리생성(model: model))

Projects/CoreKit/Sources/Data/Network/Category/CategoryClient+TestKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension CategoryClient: TestDependencyKey {
1212
Self(
1313
카테고리_삭제: { _ in },
1414
카테고리_수정: { _, _ in .mock },
15-
카테고리_목록_조회: { _, _ in .mock },
15+
카테고리_목록_조회: { _, _, _ in .mock },
1616
카테고리_생성: { _ in .mock },
1717
카테고리_프로필_목록_조회: { CategoryImageResponse.mock },
1818
유저_카테고리_개수_조회: { .mock },

Projects/CoreKit/Sources/Data/Network/Category/CategoryClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public struct CategoryClient {
1616
) async throws -> CategoryEditResponse
1717
public var 카테고리_목록_조회: @Sendable (
1818
_ model: BasePageableRequest,
19-
_ filterUncategorized: Bool
19+
_ filterUncategorized: Bool,
20+
_ filterFavoriteCategorized: Bool
2021
) async throws -> CategoryListInquiryResponse
2122
public var 카테고리_생성: @Sendable (
2223
_ model: CategoryEditRequest

Projects/CoreKit/Sources/Data/Network/Category/CategoryEndpoint.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Moya
1313
public enum CategoryEndpoint {
1414
case 카테고리_삭제(categoryId: Int)
1515
case 카테고리_수정(categoryId: Int, model: CategoryEditRequest)
16-
case 카테고리_목록_조회(model: BasePageableRequest, filterUncategorized: Bool)
16+
case 카테고리_목록_조회(model: BasePageableRequest, filterUncategorized: Bool, filterFavoriteCategorized: Bool)
1717
case 카테고리생성(model: CategoryEditRequest)
1818
case 카테고리_프로필_목록_조회
1919
case 유저_카테고리_개수_조회
@@ -83,13 +83,14 @@ extension CategoryEndpoint: TargetType {
8383
return .requestPlain
8484
case let .카테고리_수정(_, model):
8585
return .requestJSONEncodable(model)
86-
case let .카테고리_목록_조회(model, categorized):
86+
case let .카테고리_목록_조회(model, categorized, favoriteCategorized):
8787
return .requestParameters(
8888
parameters: [
8989
"page": model.page,
9090
"size": model.size,
9191
"sort": model.sort.map { String($0) }.joined(separator: ","),
92-
"filterUncategorized": categorized
92+
"filterUncategorized": categorized,
93+
"filterFavorite": favoriteCategorized
9394
],
9495
encoding: URLEncoding.default
9596
)

Projects/Domain/Sources/Base/BaseCategoryItem.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public struct BaseCategoryItem: Identifiable, Equatable, PokitSelectItem, PokitC
1919
public let openType: BaseOpenType
2020
public let keywordType: BaseInterestType
2121
public let userCount: Int
22+
public let isFavorite: Bool
2223

2324
public init(
2425
id: Int,
@@ -29,7 +30,8 @@ public struct BaseCategoryItem: Identifiable, Equatable, PokitSelectItem, PokitC
2930
createdAt: String,
3031
openType: BaseOpenType,
3132
keywordType: BaseInterestType,
32-
userCount: Int
33+
userCount: Int,
34+
isFavorite: Bool
3335
) {
3436
self.id = id
3537
self.userId = userId
@@ -40,5 +42,6 @@ public struct BaseCategoryItem: Identifiable, Equatable, PokitSelectItem, PokitC
4042
self.openType = openType
4143
self.keywordType = keywordType
4244
self.userCount = userCount
45+
self.isFavorite = isFavorite
4346
}
4447
}

Projects/Domain/Sources/DTO/Category/CategoryListInquiryResponse+Extention.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public extension CategoryItemInquiryResponse {
3333
createdAt: self.createdAt,
3434
openType: BaseOpenType(rawValue: self.openType) ?? .비공개,
3535
keywordType: BaseInterestType(rawValue: self.keywordType.slashConvertUnderBar) ?? .default,
36-
userCount: self.userCount
36+
userCount: self.userCount,
37+
isFavorite: self.isFavorite
3738
)
3839
}
3940
}

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private extension CategoryDetailFeature {
267267
case .카테고리_목록_조회_API:
268268
return .run { send in
269269
let request = BasePageableRequest(page: 0, size: 30, sort: ["createdAt,desc"])
270-
let response = try await categoryClient.카테고리_목록_조회(request, true).toDomain()
270+
let response = try await categoryClient.카테고리_목록_조회(request, true, true).toDomain()
271271
await send(.inner(.카테고리_목록_조회_API_반영(response)))
272272
}
273273

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ private extension CategoryDetailView {
210210
//TODO: v2 property 수정
211211
openType: .비공개,
212212
keywordType: .IT,
213-
userCount: 0
213+
userCount: 0,
214+
isFavorite: false
214215
)
215216
),
216217
reducer: { CategoryDetailFeature() }

0 commit comments

Comments
 (0)