feat: Begins breaking database out into it's own module, using dependencies

This commit is contained in:
2025-01-13 14:39:37 -05:00
parent 540b3e771a
commit 217dc5fa56
20 changed files with 1372 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
import Dependencies
import Foundation
public struct Employee: Equatable, Identifiable, Sendable {
public struct Employee: Codable, Equatable, Identifiable, Sendable {
public var id: UUID
public var active: Bool
public var createdAt: Date
@@ -10,7 +10,7 @@ public struct Employee: Equatable, Identifiable, Sendable {
public var updatedAt: Date
public init(
id: UUID?,
id: UUID? = nil,
active: Bool = true,
createdAt: Date? = nil,
firstName: String,
@@ -22,10 +22,20 @@ public struct Employee: Equatable, Identifiable, Sendable {
self.id = id ?? uuid()
self.active = active
self.createdAt = createdAt ?? date()
self.createdAt = createdAt ?? date.now
self.firstName = firstName
self.lastName = lastName
self.updatedAt = updatedAt ?? date()
self.updatedAt = updatedAt ?? date.now
}
}
public extension Employee {
static var mocks: [Self] {
[
.init(firstName: "Michael", lastName: "Housh"),
.init(firstName: "Blob", lastName: "Esquire"),
.init(firstName: "Testy", lastName: "McTestface")
]
}
}