feat: Begins moving models into their own module.

This commit is contained in:
2025-01-12 22:43:25 -05:00
parent 8228b1dfff
commit 540b3e771a
5 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import Dependencies
import Foundation
public struct User: Identifiable, Codable, Sendable {
public var id: UUID
public var createdAt: Date
public var email: String
public var updatedAt: Date
public var username: String
public init(
id: UUID? = nil,
createdAt: Date? = nil,
email: String,
updatedAt: Date? = nil,
username: String
) {
@Dependency(\.date) var date
@Dependency(\.uuid) var uuid
self.id = id ?? uuid()
self.createdAt = createdAt ?? date()
self.email = email
self.updatedAt = updatedAt ?? date()
self.username = username
}
}
public extension User {
static var mocks: [Self] {
[
.init(email: "blob@test.com", username: "blob"),
.init(email: "blob-jr@test.com", username: "blob-jr"),
.init(email: "blob-sr@test.com", username: "blob-sr")
]
}
}