Skip to content

Commit ca83c09

Browse files
authored
Merge pull request #191 from YAPP-Github/feat/#187-recommend-api
feat: [2.0.0] ๋ฒ„์ „ ์—…๋ฐ์ดํŠธ์— ๋”ฐ๋ฅธ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •(๋งํฌ ์ถ”์ฒœ API)
2 parents adfce8c + d5b12ce commit ca83c09

File tree

20 files changed

+319
-48
lines changed

20 files changed

+319
-48
lines changed

โ€ŽProjects/App/Sources/MainTab/MainTabFeature.swiftโ€Ž

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,7 @@ public struct MainTabFeature {
141141
public var body: some ReducerOf<Self> {
142142
Scope(state: \.pokit, action: \.pokit) { PokitRootFeature() }
143143
Scope(state: \.recommend, action: \.recommend) {
144-
withDependencies {
145-
$0[UserClient.self] = .testValue
146-
$0[ContentClient.self] = .testValue
147-
} operation: {
148-
RecommendFeature()
149-
}
144+
RecommendFeature()
150145
}
151146

152147
BindingReducer()
@@ -301,7 +296,7 @@ private extension MainTabFeature {
301296
guard let category = state.categoryOfSavedContent else { return .none }
302297
state.categoryOfSavedContent = nil
303298
return .send(.inner(.์นดํ…Œ๊ณ ๋ฆฌ์ƒ์„ธ_์ด๋™(category: category)))
304-
case .error, .text, .warning, .none:
299+
case .error, .text, .warning, .report, .none:
305300
return .none
306301
}
307302
}

โ€ŽProjects/App/Sources/MainTab/MainTabPath.swiftโ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public extension MainTabFeature {
8686
category: category
8787
)))
8888
return .none
89+
90+
case .recommend(.delegate(.์ปจํ…์ธ _์‹ ๊ณ _API_๋ฐ˜์˜)):
91+
return .send(.inner(.๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(.report(title: "์‹ ๊ณ ๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค"))))
8992

9093
/// - ํฌํ‚ท `์ถ”๊ฐ€` ๋ฒ„ํŠผ ๋ˆŒ๋ €์„ ๋•Œ
9194
case .delegate(.ํฌํ‚ท์ถ”๊ฐ€ํ•˜๊ธฐ),
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// InterestRequest.swift
3+
// CoreKit
4+
//
5+
// Created by ๊น€๋„ํ˜• on 3/1/25.
6+
//
7+
8+
import Foundation
9+
10+
public struct InterestRequest: Encodable {
11+
public let interests: [String]
12+
13+
public init(interests: [String]) {
14+
self.interests = interests
15+
}
16+
}

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient+LiveKey.swiftโ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ extension ContentClient: DependencyKey {
6464
},
6565
์ถ”์ฒœ_์ปจํ…์ธ _์กฐํšŒ: { pageable, keyword in
6666
try await provider.request(.์ถ”์ฒœ_์ปจํ…์ธ _์กฐํšŒ(pageable: pageable, keyword: keyword))
67+
},
68+
์ปจํ…์ธ _์‹ ๊ณ : { id in
69+
try await provider.requestNoBody(.์ปจํ…์ธ _์‹ ๊ณ (contentId: id))
6770
}
6871
)
6972
}()

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient+TestKey.swiftโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ extension ContentClient: TestDependencyKey {
2121
์ธ๋„ค์ผ_์ˆ˜์ •: { _, _ in },
2222
๋ฏธ๋ถ„๋ฅ˜_๋งํฌ_ํฌํ‚ท_์ด๋™: { _ in },
2323
๋ฏธ๋ถ„๋ฅ˜_๋งํฌ_์‚ญ์ œ: { _ in },
24-
์ถ”์ฒœ_์ปจํ…์ธ _์กฐํšŒ: { _, _ in .mock }
24+
์ถ”์ฒœ_์ปจํ…์ธ _์กฐํšŒ: { _, _ in .mock },
25+
์ปจํ…์ธ _์‹ ๊ณ : { _ in }
2526
)
2627
}()
2728
}

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient.swiftโ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ public struct ContentClient {
5454
_ pageable: BasePageableRequest,
5555
_ keyword: String?
5656
) async throws -> ContentListInquiryResponse
57+
public var ์ปจํ…์ธ _์‹ ๊ณ : @Sendable (
58+
_ contentId: Int
59+
) async throws -> Void
5760
}
5861

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentEndpoint.swiftโ€Ž

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public enum ContentEndpoint {
3434
pageable: BasePageableRequest,
3535
keyword: String?
3636
)
37+
case ์ปจํ…์ธ _์‹ ๊ณ (contentId: Int)
3738
}
3839

3940
extension ContentEndpoint: TargetType {
@@ -69,6 +70,8 @@ extension ContentEndpoint: TargetType {
6970
return "/uncategorized"
7071
case .์ถ”์ฒœ_์ปจํ…์ธ _์กฐํšŒ:
7172
return "/recommended"
73+
case let .์ปจํ…์ธ _์‹ ๊ณ (contentId):
74+
return "report/\(contentId)"
7275
}
7376
}
7477

@@ -81,7 +84,8 @@ extension ContentEndpoint: TargetType {
8184

8285
case .์ปจํ…์ธ _์ƒ์„ธ_์กฐํšŒ,
8386
.์ฆ๊ฒจ์ฐพ๊ธฐ,
84-
.์ปจํ…์ธ _์ถ”๊ฐ€:
87+
.์ปจํ…์ธ _์ถ”๊ฐ€,
88+
.์ปจํ…์ธ _์‹ ๊ณ :
8589
return .post
8690

8791
case .์ปจํ…์ธ _์ˆ˜์ •,
@@ -169,6 +173,8 @@ extension ContentEndpoint: TargetType {
169173

170174
case let .๋ฏธ๋ถ„๋ฅ˜_๋งํฌ_์‚ญ์ œ(model):
171175
return .requestJSONEncodable(model)
176+
case .์ปจํ…์ธ _์‹ ๊ณ :
177+
return .requestPlain
172178
}
173179
}
174180

โ€ŽProjects/CoreKit/Sources/Data/Network/User/UserClient+LiveKey.swiftโ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ extension UserClient: DependencyKey {
4141
},
4242
์œ ์ €_๊ด€์‹ฌ์‚ฌ_๋ชฉ๋ก_์กฐํšŒ: {
4343
try await provider.request(.์œ ์ €_๊ด€์‹ฌ์‚ฌ_๋ชฉ๋ก_์กฐํšŒ)
44+
},
45+
๊ด€์‹ฌ์‚ฌ_์ˆ˜์ •: { model in
46+
try await provider.requestNoBody(.๊ด€์‹ฌ์‚ฌ_์ˆ˜์ •(model: model))
4447
}
4548
)
4649
}()

โ€ŽProjects/CoreKit/Sources/Data/Network/User/UserClient+TestKey.swiftโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ extension UserClient: TestDependencyKey {
2020
๋‹‰๋„ค์ž„_์กฐํšŒ: { .mock },
2121
fcm_ํ† ํฐ_์ €์žฅ: { _ in .mock },
2222
ํ”„๋กœํ•„_์ด๋ฏธ์ง€_๋ชฉ๋ก_์กฐํšŒ: { [.mock] },
23-
์œ ์ €_๊ด€์‹ฌ์‚ฌ_๋ชฉ๋ก_์กฐํšŒ: { InterestResponse.mock }
23+
์œ ์ €_๊ด€์‹ฌ์‚ฌ_๋ชฉ๋ก_์กฐํšŒ: { InterestResponse.mock },
24+
๊ด€์‹ฌ์‚ฌ_์ˆ˜์ •: { _ in }
2425
)
2526
}()
2627
}

โ€ŽProjects/CoreKit/Sources/Data/Network/User/UserClient.swiftโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ public struct UserClient {
1818
public var fcm_ํ† ํฐ_์ €์žฅ: @Sendable (_ model: FCMRequest) async throws -> FCMResponse
1919
public var ํ”„๋กœํ•„_์ด๋ฏธ์ง€_๋ชฉ๋ก_์กฐํšŒ: @Sendable () async throws -> [BaseProfileImageResponse]
2020
public var ์œ ์ €_๊ด€์‹ฌ์‚ฌ_๋ชฉ๋ก_์กฐํšŒ: @Sendable () async throws -> [InterestResponse]
21+
public var ๊ด€์‹ฌ์‚ฌ_์ˆ˜์ •: @Sendable (_ model: InterestRequest) async throws -> Void
2122
}

0 commit comments

Comments
ย (0)