Added the catalogue models and seed to support phase 2 of the POC prototype in the Persistence package.

This commit is contained in:
javier committed 2026-09-21 11:44:41 +02:00
1 parent ea89ea892a
commit 09c7b8a1a7
10 files changed
+238 -21

No files matched your search

@@ -0,0 +1,55 @@
import FluentKit
import Foundation
/// A FluentKit model of a single `users` row.
final class UserRecord: Model, @unchecked Sendable {
// MARK: Properties
static let schema = "users"
@ID(key: .id)
var id: UUID?
@Field(key: "email")
var email: String
@Field(key: "display_name")
var displayName: String
// MARK: Initializers
init() {}
/// Creates a record with the given values.
/// - Parameters:
/// - email: the account's normalized email address.
/// - displayName: the name other people see.
init(
email: String,
displayName: String
) {
self.email = email
self.displayName = displayName
}
}
// MARK: - Extensions
extension UserRecord {
// MARK: Computed
/// The `Sendable` snapshot of the saved record.
var snapshot: User {
get throws {
.init(
id: try requireID(),
email: email,
displayName: displayName
)
}
}
}