feat: 定义仓库协议与用例(含会话)
This commit is contained in:
22
IosClientKit/Sources/CoreDomain/PlanUseCase.swift
Normal file
22
IosClientKit/Sources/CoreDomain/PlanUseCase.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import CoreModel
|
||||
|
||||
/// 获取/提交计划数据的用例。
|
||||
public struct PlanUseCase: Sendable {
|
||||
private let repository: PlanRepository
|
||||
|
||||
public init(repository: PlanRepository) {
|
||||
self.repository = repository
|
||||
}
|
||||
|
||||
public func observePlan(type: PlanType) -> AsyncThrowingStream<PlanRecord, Error> {
|
||||
repository.observePlan(type: type)
|
||||
}
|
||||
|
||||
public func observePlanSubmit(type: PlanType, periodKey: String) -> AsyncThrowingStream<PlanSubmitData, Error> {
|
||||
repository.observePlanSubmit(type: type, periodKey: periodKey)
|
||||
}
|
||||
|
||||
public func savePlan(type: PlanType, periodKey: String, content: String, attachments: [String]) async throws {
|
||||
try await repository.savePlan(type: type, periodKey: periodKey, content: content, attachments: attachments)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user