feat: Begins views, login is currently not working.

This commit is contained in:
2025-01-06 17:28:43 -05:00
parent 5efed277a1
commit 35ca73e1b4
10 changed files with 109 additions and 15 deletions

View File

@@ -2,6 +2,13 @@ import Fluent
import struct Foundation.UUID
import Vapor
/// The employee database model.
///
/// An employee is someone that PO's can be generated for. They can be either a field
/// employee / technician, an office employee, or an administrator.
///
/// # NOTE: Only `User` types can login and generate po's for employees.
///
final class Employee: Model, @unchecked Sendable {
static let schema = "employee"

View File

@@ -1,6 +1,11 @@
import Fluent
import Vapor
/// The purchase order database model.
///
/// # NOTE: An initial purchase order should be created with an `id` higher than our current PO
/// so that subsequent PO's are generated with higher values than our current system produces.
/// once the first one is set, the rest will auto-increment from there.
final class PurchaseOrder: Model, Content, @unchecked Sendable {
static let schema = "purchase_order"
@@ -80,6 +85,7 @@ final class PurchaseOrder: Model, Content, @unchecked Sendable {
extension PurchaseOrder {
struct Create: Content {
let id: Int?
let workOrder: Int?
let materials: String
let customer: String
@@ -89,7 +95,7 @@ extension PurchaseOrder {
func toModel(createdByID: User.IDValue) -> PurchaseOrder {
.init(
id: nil,
id: id,
workOrder: workOrder,
materials: materials,
customer: customer,

View File

@@ -1,6 +1,13 @@
import Fluent
import Vapor
/// The user database model.
///
/// A user is someone who is able to login and generate PO's for employees. Generally a user should also
/// have an employee profile, but not all employees are users. Users are generally restricted to office workers
/// and administrators.
///
///
final class User: Model, @unchecked Sendable {
static let schema = "user"
@@ -82,6 +89,7 @@ extension User: ModelAuthenticatable {
}
extension User: ModelSessionAuthenticatable {}
extension User: ModelCredentialsAuthenticatable {}
extension User.Create: Validatable {
static func validations(_ validations: inout Validations) {