feat: Begins integrating database client into vapor app.

This commit is contained in:
2025-01-14 11:50:06 -05:00
parent c8bcffa0b5
commit ccf80f05a7
42 changed files with 2378 additions and 2540 deletions

View File

@@ -24,7 +24,40 @@ public struct Employee: Codable, Equatable, Identifiable, Sendable {
self.lastName = lastName
self.updatedAt = updatedAt
}
}
public extension Employee {
struct Create: Codable, Sendable {
public let firstName: String
public let lastName: String
public let active: Bool?
public init(
firstName: String,
lastName: String,
active: Bool? = nil
) {
self.firstName = firstName
self.lastName = lastName
self.active = active
}
}
struct Update: Codable, Sendable {
public let firstName: String?
public let lastName: String?
public let active: Bool?
public init(
firstName: String? = nil,
lastName: String? = nil,
active: Bool? = nil
) {
self.firstName = firstName
self.lastName = lastName
self.active = active
}
}
}
// public extension Employee {

View File

@@ -38,3 +38,35 @@ public struct PurchaseOrder: Codable, Equatable, Identifiable, Sendable {
self.updatedAt = updatedAt
}
}
public extension PurchaseOrder {
struct Create: Codable, Sendable {
public let id: Int?
public let workOrder: Int?
public let materials: String
public let customer: String
public let truckStock: Bool?
public let createdForID: Employee.ID
public let vendorBranchID: VendorBranch.ID
public init(
id: Int? = nil,
workOrder: Int? = nil,
materials: String,
customer: String,
truckStock: Bool? = nil,
createdForID: Employee.ID,
vendorBranchID: VendorBranch.ID
) {
self.id = id
self.workOrder = workOrder
self.materials = materials
self.customer = customer
self.truckStock = truckStock
self.createdForID = createdForID
self.vendorBranchID = vendorBranchID
}
}
}

View File

@@ -24,6 +24,61 @@ public struct User: Codable, Equatable, Identifiable, Sendable {
}
}
public extension User {
struct Create: Codable, Sendable {
public let username: String
public let email: String
public let password: String
public let confirmPassword: String
public init(
username: String,
email: String,
password: String,
confirmPassword: String
) {
self.username = username
self.email = email
self.password = password
self.confirmPassword = confirmPassword
}
}
struct Login: Codable, Sendable {
public let username: String?
public let email: String?
public let password: String
public init(
username: String?,
email: String? = nil,
password: String
) {
self.username = username
self.email = email
self.password = password
}
}
struct Token: Codable, Equatable, Identifiable, Sendable {
public let id: UUID
public let userID: User.ID
public let value: String
public init(
id: UUID,
userID: User.ID,
value: String
) {
self.id = id
self.userID = userID
self.value = value
}
}
}
// public extension User {
// static var mocks: [Self] {
// [

View File

@@ -23,6 +23,25 @@ public struct Vendor: Codable, Equatable, Identifiable, Sendable {
}
}
public extension Vendor {
struct Create: Codable, Sendable {
public let name: String
public init(name: String) {
self.name = name
}
}
struct Update: Codable, Sendable {
public let name: String?
public init(name: String?) {
self.name = name
}
}
}
// public extension Vendor {
//
// static var mocks: [Self] {

View File

@@ -22,3 +22,23 @@ public struct VendorBranch: Codable, Equatable, Identifiable, Sendable {
self.updatedAt = updatedAt
}
}
public extension VendorBranch {
struct Create: Codable, Sendable {
public let name: String
public let vendorID: Vendor.ID
public init(name: String, vendorID: Vendor.ID) {
self.name = name
self.vendorID = vendorID
}
}
struct Update: Codable, Sendable {
public let name: String?
public init(name: String?) {
self.name = name
}
}
}