feat: working on detail views.

This commit is contained in:
2025-01-12 17:42:06 -05:00
parent 0e31d2c30c
commit 1ce369e156
27 changed files with 527 additions and 137 deletions

View File

@@ -15,6 +15,7 @@ struct UserDB: Sendable {
var create: @Sendable (User.Create) async throws -> User.DTO
var delete: @Sendable (User.IDValue) async throws -> Void
var fetchAll: @Sendable () async throws -> [User.DTO]
var get: @Sendable (User.IDValue) async throws -> User.DTO?
var login: @Sendable (User) async throws -> UserToken
}
@@ -46,6 +47,9 @@ extension UserDB: TestDependencyKey {
fetchAll: {
try await User.query(on: db).all().map { $0.toDTO() }
},
get: { id in
try await User.find(id, on: db).map { $0.toDTO() }
},
login: { user in
let token = try user.generateToken()
try await token.save(on: db)