From bfc019b75fa2d67c4671150b3227d6510aacb079 Mon Sep 17 00:00:00 2001 From: rpm-mcarman <65228808+rpm-mcarman@users.noreply.github.com> Date: Tue, 2 Apr 2024 16:06:39 -0400 Subject: [PATCH] Added a bunch of controllers --- .../{File 5.swift => cntrlFluid.swift} | 0 .../cntrlFuel.swift} | 22 +++++++++---------- .../{ => BaseControllers}/cntrlGate.swift | 0 .../cntrlIncompleteReason.swift | 8 +++++++ .../{File.swift => cntrlInputType.swift} | 0 .../BaseControllers/cntrlJobSite.swift | 8 +++++++ .../BaseControllers/cntrlLevel.swift | 8 +++++++ .../BaseControllers/cntrlLocation.swift | 8 +++++++ .../BaseControllers/cntrlNoteType.swift | 8 +++++++ .../BaseControllers/cntrlPart.swift | 8 +++++++ .../BaseControllers/cntrlPriority.swift | 8 +++++++ .../BaseControllers/cntrlReason.swift | 8 +++++++ .../BaseControllers/cntrlRepairType.swift | 8 +++++++ .../BaseControllers/cntrlSMSCCode.swift | 8 +++++++ .../BaseControllers/cntrlSignatureType.swift | 8 +++++++ .../BaseControllers/cntrlState.swift | 8 +++++++ .../BaseControllers/cntrlStatus.swift | 8 +++++++ .../cntrlValueType.swift | 0 .../BaseControllers/cntrlViscosity.swift | 8 +++++++ .../cntrlCompartment.swift | 8 +++++++ .../cntrlCompartmentLocation.swift | 8 +++++++ .../CustomerControllers/cntrlContact.swift | 8 +++++++ .../cntrlContactInfo.swift | 8 +++++++ .../CustomerControllers/cntrlCustomer.swift | 8 +++++++ .../CustomerControllers/cntrlEquipment.swift | 8 +++++++ .../CustomerControllers/cntrlMake.swift | 8 +++++++ .../cntrlModel.swift} | 0 .../cntrlObjectProperty.swift | 8 +++++++ .../CustomerControllers/cntrlProduct.swift | 8 +++++++ 29 files changed, 195 insertions(+), 11 deletions(-) rename Sources/App/Controllers/BaseControllers/{File 5.swift => cntrlFluid.swift} (100%) rename Sources/App/Controllers/{cntrlLocation.swift => BaseControllers/cntrlFuel.swift} (52%) rename Sources/App/Controllers/{ => BaseControllers}/cntrlGate.swift (100%) create mode 100644 Sources/App/Controllers/BaseControllers/cntrlIncompleteReason.swift rename Sources/App/Controllers/BaseControllers/{File.swift => cntrlInputType.swift} (100%) create mode 100644 Sources/App/Controllers/BaseControllers/cntrlJobSite.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlLevel.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlLocation.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlNoteType.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlPart.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlPriority.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlReason.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlRepairType.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlSMSCCode.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlSignatureType.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlState.swift create mode 100644 Sources/App/Controllers/BaseControllers/cntrlStatus.swift rename Sources/App/Controllers/{ => BaseControllers}/cntrlValueType.swift (100%) create mode 100644 Sources/App/Controllers/BaseControllers/cntrlViscosity.swift create mode 100644 Sources/App/Controllers/CompartmentControllers/cntrlCompartment.swift create mode 100644 Sources/App/Controllers/CompartmentControllers/cntrlCompartmentLocation.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlContact.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlContactInfo.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlCustomer.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlEquipment.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlMake.swift rename Sources/App/Controllers/{BaseControllers/File 6.swift => CustomerControllers/cntrlModel.swift} (100%) create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlObjectProperty.swift create mode 100644 Sources/App/Controllers/CustomerControllers/cntrlProduct.swift diff --git a/Sources/App/Controllers/BaseControllers/File 5.swift b/Sources/App/Controllers/BaseControllers/cntrlFluid.swift similarity index 100% rename from Sources/App/Controllers/BaseControllers/File 5.swift rename to Sources/App/Controllers/BaseControllers/cntrlFluid.swift diff --git a/Sources/App/Controllers/cntrlLocation.swift b/Sources/App/Controllers/BaseControllers/cntrlFuel.swift similarity index 52% rename from Sources/App/Controllers/cntrlLocation.swift rename to Sources/App/Controllers/BaseControllers/cntrlFuel.swift index 6e6df12..9ea9f77 100644 --- a/Sources/App/Controllers/cntrlLocation.swift +++ b/Sources/App/Controllers/BaseControllers/cntrlFuel.swift @@ -1,5 +1,5 @@ // -// Location.swift +// cntrlFuel.swift // // // Created by Michiel Carman on 4/1/24. @@ -8,9 +8,9 @@ import Fluent import Vapor -struct cntrlLocation: RouteCollection { +struct cntrlFuel: RouteCollection { func boot(routes: RoutesBuilder) throws { - let rts = routes.grouped("locations") + let rts = routes.grouped("fuels") rts.get(use: index) rts.post(use: create) rts.put(use: update) @@ -19,18 +19,18 @@ struct cntrlLocation: RouteCollection { } } - func index(req: Request) async throws -> [mdlLocation] { - try await mdlLocation.query(on: req.db).all() + func index(req: Request) async throws -> [mdlFuel] { + try await mdlFuel.query(on: req.db).all() } - func create(req: Request) async throws -> mdlLocation { - let obj = try req.content.decode(mdlLocation.self) + func create(req: Request) async throws -> mdlFuel { + let obj = try req.content.decode(mdlFuel.self) try await obj.save(on: req.db) return obj } - func update(req: Request) async throws -> mdlLocation{ - let obj = try req.content.decode(mdlLocation.self) - let dbobj = try await mdlLocation.query(on: req.db).filter(\.$id == obj.id!).first()! + func update(req: Request) async throws -> mdlFuel{ + let obj = try req.content.decode(mdlFuel.self) + let dbobj = try await mdlFuel.query(on: req.db).filter(\.$id == obj.id!).first()! dbobj.updatedate = Date() dbobj.updateuserid = -1 @@ -40,7 +40,7 @@ struct cntrlLocation: RouteCollection { } func delete(req: Request) async throws -> HTTPStatus { - guard let obj = try await mdlLocation.find(req.parameters.get("id"), on: req.db) else { + guard let obj = try await mdlFuel.find(req.parameters.get("id"), on: req.db) else { throw Abort(.notFound) } try await obj.delete(on: req.db) diff --git a/Sources/App/Controllers/cntrlGate.swift b/Sources/App/Controllers/BaseControllers/cntrlGate.swift similarity index 100% rename from Sources/App/Controllers/cntrlGate.swift rename to Sources/App/Controllers/BaseControllers/cntrlGate.swift diff --git a/Sources/App/Controllers/BaseControllers/cntrlIncompleteReason.swift b/Sources/App/Controllers/BaseControllers/cntrlIncompleteReason.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlIncompleteReason.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/File.swift b/Sources/App/Controllers/BaseControllers/cntrlInputType.swift similarity index 100% rename from Sources/App/Controllers/BaseControllers/File.swift rename to Sources/App/Controllers/BaseControllers/cntrlInputType.swift diff --git a/Sources/App/Controllers/BaseControllers/cntrlJobSite.swift b/Sources/App/Controllers/BaseControllers/cntrlJobSite.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlJobSite.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlLevel.swift b/Sources/App/Controllers/BaseControllers/cntrlLevel.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlLevel.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlLocation.swift b/Sources/App/Controllers/BaseControllers/cntrlLocation.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlLocation.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlNoteType.swift b/Sources/App/Controllers/BaseControllers/cntrlNoteType.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlNoteType.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlPart.swift b/Sources/App/Controllers/BaseControllers/cntrlPart.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlPart.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlPriority.swift b/Sources/App/Controllers/BaseControllers/cntrlPriority.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlPriority.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlReason.swift b/Sources/App/Controllers/BaseControllers/cntrlReason.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlReason.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlRepairType.swift b/Sources/App/Controllers/BaseControllers/cntrlRepairType.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlRepairType.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlSMSCCode.swift b/Sources/App/Controllers/BaseControllers/cntrlSMSCCode.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlSMSCCode.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlSignatureType.swift b/Sources/App/Controllers/BaseControllers/cntrlSignatureType.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlSignatureType.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlState.swift b/Sources/App/Controllers/BaseControllers/cntrlState.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlState.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/cntrlStatus.swift b/Sources/App/Controllers/BaseControllers/cntrlStatus.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlStatus.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/cntrlValueType.swift b/Sources/App/Controllers/BaseControllers/cntrlValueType.swift similarity index 100% rename from Sources/App/Controllers/cntrlValueType.swift rename to Sources/App/Controllers/BaseControllers/cntrlValueType.swift diff --git a/Sources/App/Controllers/BaseControllers/cntrlViscosity.swift b/Sources/App/Controllers/BaseControllers/cntrlViscosity.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/BaseControllers/cntrlViscosity.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CompartmentControllers/cntrlCompartment.swift b/Sources/App/Controllers/CompartmentControllers/cntrlCompartment.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/CompartmentControllers/cntrlCompartment.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CompartmentControllers/cntrlCompartmentLocation.swift b/Sources/App/Controllers/CompartmentControllers/cntrlCompartmentLocation.swift new file mode 100644 index 0000000..a0490df --- /dev/null +++ b/Sources/App/Controllers/CompartmentControllers/cntrlCompartmentLocation.swift @@ -0,0 +1,8 @@ +// +// File.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlContact.swift b/Sources/App/Controllers/CustomerControllers/cntrlContact.swift new file mode 100644 index 0000000..a0490df --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlContact.swift @@ -0,0 +1,8 @@ +// +// File.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlContactInfo.swift b/Sources/App/Controllers/CustomerControllers/cntrlContactInfo.swift new file mode 100644 index 0000000..f2f19ea --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlContactInfo.swift @@ -0,0 +1,8 @@ +// +// File 2.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlCustomer.swift b/Sources/App/Controllers/CustomerControllers/cntrlCustomer.swift new file mode 100644 index 0000000..d0b8c0e --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlCustomer.swift @@ -0,0 +1,8 @@ +// +// File 3.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlEquipment.swift b/Sources/App/Controllers/CustomerControllers/cntrlEquipment.swift new file mode 100644 index 0000000..14829b0 --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlEquipment.swift @@ -0,0 +1,8 @@ +// +// File 4.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlMake.swift b/Sources/App/Controllers/CustomerControllers/cntrlMake.swift new file mode 100644 index 0000000..4782d85 --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlMake.swift @@ -0,0 +1,8 @@ +// +// File 5.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/BaseControllers/File 6.swift b/Sources/App/Controllers/CustomerControllers/cntrlModel.swift similarity index 100% rename from Sources/App/Controllers/BaseControllers/File 6.swift rename to Sources/App/Controllers/CustomerControllers/cntrlModel.swift diff --git a/Sources/App/Controllers/CustomerControllers/cntrlObjectProperty.swift b/Sources/App/Controllers/CustomerControllers/cntrlObjectProperty.swift new file mode 100644 index 0000000..2a7b01d --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlObjectProperty.swift @@ -0,0 +1,8 @@ +// +// File 7.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation diff --git a/Sources/App/Controllers/CustomerControllers/cntrlProduct.swift b/Sources/App/Controllers/CustomerControllers/cntrlProduct.swift new file mode 100644 index 0000000..a0490df --- /dev/null +++ b/Sources/App/Controllers/CustomerControllers/cntrlProduct.swift @@ -0,0 +1,8 @@ +// +// File.swift +// +// +// Created by Michiel Carman on 4/2/24. +// + +import Foundation