2021-12-23 03:44:47 +00:00
|
|
|
import Foundation
|
|
|
|
|
2021-12-23 13:10:33 +00:00
|
|
|
public struct Category: Identifiable, Hashable, Codable {
|
|
|
|
public let budgetId: String
|
|
|
|
public let id: String
|
|
|
|
public let title: String
|
|
|
|
public let description: String?
|
|
|
|
public let amount: Int
|
|
|
|
public let expense: Bool
|
|
|
|
public let archived: Bool
|
2021-12-23 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 13:10:33 +00:00
|
|
|
public protocol CategoryRepository {
|
2021-12-23 03:44:47 +00:00
|
|
|
func getCategories(budgetId: String?, expense: Bool?, archived: Bool?, count: Int?, page: Int?) async throws -> [Category]
|
|
|
|
func getCategory(_ categoryId: String) async throws -> Category
|
|
|
|
func createCategory(_ category: Category) async throws -> Category
|
|
|
|
func updateCategory(_ category: Category) async throws -> Category
|
|
|
|
func deleteCategory(_ id: String) async throws
|
|
|
|
}
|