29 lines
918 B
Swift
29 lines
918 B
Swift
import Dependencies
|
|
import DependenciesMacros
|
|
import Foundation
|
|
import SharedModels
|
|
import Vapor
|
|
|
|
public extension DatabaseClient {
|
|
|
|
@DependencyClient
|
|
struct Users: Sendable {
|
|
public var count: @Sendable () async throws -> Int
|
|
public var create: @Sendable (User.Create) async throws -> User
|
|
public var delete: @Sendable (User.ID) async throws -> Void
|
|
public var fetchAll: @Sendable () async throws -> [User]
|
|
public var get: @Sendable (User.ID) async throws -> User?
|
|
public var login: @Sendable (User.Login) async throws -> User.Token
|
|
public var logout: @Sendable (User.Token.ID) async throws -> Void
|
|
public var token: @Sendable (User.ID) async throws -> User.Token
|
|
}
|
|
}
|
|
|
|
extension User: Content {}
|
|
extension User.Create: Content {}
|
|
extension User.Token: Content {}
|
|
|
|
extension DatabaseClient.Users: TestDependencyKey {
|
|
public static let testValue: DatabaseClient.Users = Self()
|
|
}
|