From 177c231f5392d46f67d67dc815fcba050649bf39 Mon Sep 17 00:00:00 2001
From: rpm-mcarman <65228808+rpm-mcarman@users.noreply.github.com>
Date: Thu, 3 Nov 2022 14:39:41 -0400
Subject: [PATCH] First Commit First Commit
---
.DS_Store | Bin 0 -> 6148 bytes
.../contents.xcworkspacedata | 7 +
.../UserInterfaceState.xcuserstate | Bin 0 -> 14361 bytes
.../xcschemes/xcschememanagement.plist | 14 +
Dockerfile | 65 +++++
Package.resolved | 205 ++++++++++++++
Package.swift | 36 +++
Resources/Views/index.leaf | 12 +
Sources/.DS_Store | Bin 0 -> 6148 bytes
Sources/App/.DS_Store | Bin 0 -> 6148 bytes
Sources/App/Controllers/.gitkeep | 0
.../c/CPCLTemplateCommandCtrl.swift | 155 ++++++++++
.../App/Controllers/c/CPCLTemplateCtrl.swift | 157 +++++++++++
Sources/App/Controllers/c/CategoryCtrl.swift | 155 ++++++++++
.../Controllers/c/ComparisonTypeCtrl.swift | 154 ++++++++++
.../App/Controllers/c/CompartmentCtrl.swift | 160 +++++++++++
.../Controllers/c/CompartmentGroupCtrl.swift | 155 ++++++++++
.../c/CompartmentLocationCtrl.swift | 161 +++++++++++
Sources/App/Controllers/c/ContactCtrl.swift | 170 +++++++++++
.../App/Controllers/c/ContactMethodCtrl.swift | 174 ++++++++++++
Sources/App/Controllers/c/CustomerCtrl.swift | 214 ++++++++++++++
Sources/App/Controllers/d/DataTypeCtrl.swift | 130 +++++++++
Sources/App/Controllers/d/DivisionCtrl.swift | 157 +++++++++++
Sources/App/Controllers/f/FileCtrl.swift | 181 ++++++++++++
Sources/App/Controllers/f/FluidCtrl.swift | 160 +++++++++++
Sources/App/Controllers/f/FuelLevelCtrl.swift | 155 ++++++++++
Sources/App/Controllers/g/GateCtrl.swift | 104 +++++++
.../Controllers/i/IncompleteReasonCtrl.swift | 155 ++++++++++
Sources/App/Controllers/i/InputTypeCtrl.swift | 130 +++++++++
.../i/InspectionCategoryCtrl.swift | 170 +++++++++++
.../i/InspectionCategoryItemCtrl.swift | 217 ++++++++++++++
...spectionCategoryItemResponseTypeCtrl.swift | 160 +++++++++++
.../i/InspectionCategoryItemSpecCtrl.swift | 163 +++++++++++
.../InspectionCategoryItemSpecItemCtrl.swift | 190 +++++++++++++
...spectionCategoryItemSpecItemTestCtrl.swift | 156 ++++++++++
...pectionCategoryItemSpecItemValueCtrl.swift | 157 +++++++++++
.../App/Controllers/i/InspectionCtrl.swift | 185 ++++++++++++
.../Controllers/i/InspectionLevelCtrl.swift | 168 +++++++++++
.../Controllers/i/InspectionTypeCtrl.swift | 160 +++++++++++
.../Controllers/i/InspectionUserCtrl.swift | 145 ++++++++++
Sources/App/Controllers/i/ItemCtrl.swift | 189 +++++++++++++
Sources/App/Controllers/j/JobSiteCtrl.swift | 155 ++++++++++
.../App/Controllers/l/LabSettingCtrl.swift | 179 ++++++++++++
Sources/App/Controllers/l/LevelCtrl.swift | 155 ++++++++++
Sources/App/Controllers/l/LicenseCtrl.swift | 150 ++++++++++
Sources/App/Controllers/l/LocationCtrl.swift | 209 ++++++++++++++
Sources/App/Controllers/m/MachineCtrl.swift | 234 +++++++++++++++
.../App/Controllers/m/MachineMeterCtrl.swift | 155 ++++++++++
.../App/Controllers/m/MachineNumberCtrl.swift | 153 ++++++++++
.../App/Controllers/m/MachineTypeCtrl.swift | 150 ++++++++++
Sources/App/Controllers/m/MakeCtrl.swift | 161 +++++++++++
Sources/App/Controllers/m/ModelCtrl.swift | 191 +++++++++++++
Sources/App/Controllers/m/ModuleCtrl.swift | 160 +++++++++++
Sources/App/Controllers/n/NoteCtrl.swift | 156 ++++++++++
Sources/App/Controllers/n/NoteTypeCtrl.swift | 145 ++++++++++
Sources/App/Controllers/o/OilSampleCtrl.swift | 150 ++++++++++
.../App/Controllers/o/OilSampleItemCtrl.swift | 238 ++++++++++++++++
.../Controllers/o/OilSampleLabelCtrl.swift | 190 +++++++++++++
Sources/App/Controllers/p/PartCtrl.swift | 155 ++++++++++
Sources/App/Controllers/p/PriorityCtrl.swift | 145 ++++++++++
Sources/App/Controllers/p/ProductCtrl.swift | 160 +++++++++++
Sources/App/Controllers/r/ReasonCtrl.swift | 155 ++++++++++
.../App/Controllers/r/RepairTypeCtrl.swift | 150 ++++++++++
.../App/Controllers/r/ResponseTypeCtrl.swift | 169 +++++++++++
Sources/App/Controllers/r/RoleCtrl.swift | 135 +++++++++
Sources/App/Controllers/s/SignatureCtrl.swift | 150 ++++++++++
.../App/Controllers/s/SignatureTypeCtrl.swift | 145 ++++++++++
Sources/App/Controllers/s/SpecCtrl.swift | 168 +++++++++++
Sources/App/Controllers/s/SpecItemCtrl.swift | 174 ++++++++++++
.../App/Controllers/s/SpecItemValueCtrl.swift | 155 ++++++++++
Sources/App/Controllers/s/StatusCtrl.swift | 145 ++++++++++
.../Controllers/t/TemplateCategoryCtrl.swift | 158 +++++++++++
.../t/TemplateCategoryItemCtrl.swift | 158 +++++++++++
.../t/TemplateCategoryItemSpecCtrl.swift | 150 ++++++++++
Sources/App/Controllers/t/TemplateCtrl.swift | 198 +++++++++++++
Sources/App/Controllers/u/UnitCtrl.swift | 120 ++++++++
Sources/App/Controllers/u/UserCtrl.swift | 206 ++++++++++++++
.../Controllers/u/UserDefinedCodeCtrl.swift | 161 +++++++++++
Sources/App/Controllers/v/ValueTypeCtrl.swift | 154 ++++++++++
Sources/App/Controllers/v/ViscosityCtrl.swift | 160 +++++++++++
Sources/App/Controllers/w/WorkOrderCtrl.swift | 266 ++++++++++++++++++
.../Controllers/w/WorkOrderStatusCtrl.swift | 155 ++++++++++
.../App/Controllers/w/WorkOrderUserCtrl.swift | 150 ++++++++++
.../Controllers/x/XCustomerMachineCtrl.swift | 150 ++++++++++
.../Controllers/x/XFluidViscosityCtrl.swift | 151 ++++++++++
.../Controllers/x/XItemResponseTypeCtrl.swift | 145 ++++++++++
.../App/Controllers/x/XUserModuleCtrl.swift | 150 ++++++++++
Sources/App/Controllers/x/XUserRoleCtrl.swift | 144 ++++++++++
Sources/App/Migrations/TableCreationOrdermd | 89 ++++++
Sources/App/Models/c/CPCLTemplate.swift | 120 ++++++++
.../App/Models/c/CPCLTemplateCommand.swift | 167 +++++++++++
Sources/App/Models/c/Category.swift | 108 +++++++
Sources/App/Models/c/ComparisonType.swift | 113 ++++++++
Sources/App/Models/c/Compartment.swift | 89 ++++++
Sources/App/Models/c/CompartmentGroup.swift | 85 ++++++
.../App/Models/c/CompartmentLocation.swift | 89 ++++++
Sources/App/Models/c/Consumption.swift | 57 ++++
Sources/App/Models/c/ConsumptionItem.swift | 77 +++++
Sources/App/Models/c/Contact.swift | 118 ++++++++
Sources/App/Models/c/ContactMethod.swift | 125 ++++++++
Sources/App/Models/c/Customer.swift | 137 +++++++++
Sources/App/Models/d/DataType.swift | 86 ++++++
Sources/App/Models/d/Division.swift | 113 ++++++++
Sources/App/Models/f/File.swift | 147 ++++++++++
Sources/App/Models/f/Fluid.swift | 112 ++++++++
Sources/App/Models/f/FuelLevel.swift | 123 ++++++++
Sources/App/Models/g/Gate.swift | 124 ++++++++
Sources/App/Models/i/IncompleteReason.swift | 84 ++++++
Sources/App/Models/i/InputType.swift | 80 ++++++
Sources/App/Models/i/Inspection.swift | 128 +++++++++
Sources/App/Models/i/InspectionCategory.swift | 117 ++++++++
.../App/Models/i/InspectionCategoryItem.swift | 157 +++++++++++
.../InspectionCategoryItemResponseType.swift | 108 +++++++
.../Models/i/InspectionCategoryItemSpec.swift | 108 +++++++
.../i/InspectionCategoryItemSpecItem.swift | 130 +++++++++
.../InspectionCategoryItemSpecItemTest.swift | 103 +++++++
.../InspectionCategoryItemSpecItemValue.swift | 126 +++++++++
Sources/App/Models/i/InspectionLevel.swift | 113 ++++++++
Sources/App/Models/i/InspectionType.swift | 110 ++++++++
Sources/App/Models/i/InspectionUser.swift | 95 +++++++
Sources/App/Models/i/Item.swift | 132 +++++++++
Sources/App/Models/j/JobSite.swift | 112 ++++++++
Sources/App/Models/l/LabSetting.swift | 133 +++++++++
Sources/App/Models/l/Level.swift | 104 +++++++
Sources/App/Models/l/License.swift | 98 +++++++
Sources/App/Models/l/Location.swift | 184 ++++++++++++
Sources/App/Models/m/Machine.swift | 173 ++++++++++++
Sources/App/Models/m/MachineMeter.swift | 108 +++++++
Sources/App/Models/m/MachineNumber.swift | 109 +++++++
Sources/App/Models/m/MachineType.swift | 110 ++++++++
Sources/App/Models/m/Make.swift | 111 ++++++++
Sources/App/Models/m/Model.swift | 121 ++++++++
Sources/App/Models/m/Module.swift | 125 ++++++++
Sources/App/Models/n/Note.swift | 112 ++++++++
Sources/App/Models/n/NoteType.swift | 107 +++++++
Sources/App/Models/o/OilSample.swift | 98 +++++++
Sources/App/Models/o/OilSampleItem.swift | 232 +++++++++++++++
Sources/App/Models/o/OilSampleLabel.swift | 175 ++++++++++++
Sources/App/Models/p/Part.swift | 103 +++++++
Sources/App/Models/p/Priority.swift | 101 +++++++
Sources/App/Models/p/Product.swift | 112 ++++++++
Sources/App/Models/r/Reason.swift | 112 ++++++++
Sources/App/Models/r/RepairType.swift | 108 +++++++
Sources/App/Models/r/ResponseType.swift | 119 ++++++++
Sources/App/Models/r/Role.swift | 81 ++++++
Sources/App/Models/s/Signature.swift | 106 +++++++
Sources/App/Models/s/SignatureType.swift | 99 +++++++
Sources/App/Models/s/Spec.swift | 113 ++++++++
Sources/App/Models/s/SpecItem.swift | 120 ++++++++
Sources/App/Models/s/SpecItemValue.swift | 112 ++++++++
Sources/App/Models/s/Status.swift | 108 +++++++
Sources/App/Models/t/Template.swift | 142 ++++++++++
Sources/App/Models/t/TemplateCategory.swift | 106 +++++++
.../App/Models/t/TemplateCategoryItem.swift | 103 +++++++
.../Models/t/TemplateCategoryItemSpec.swift | 98 +++++++
Sources/App/Models/u/Unit.swift | 135 +++++++++
Sources/App/Models/u/User.swift | 153 ++++++++++
Sources/App/Models/u/UserDefinedCode.swift | 117 ++++++++
Sources/App/Models/v/ValueType.swift | 112 ++++++++
Sources/App/Models/v/Viscosity.swift | 110 ++++++++
Sources/App/Models/w/WokrOrder.swift | 171 +++++++++++
Sources/App/Models/w/WorkOrderPart.swift | 82 ++++++
Sources/App/Models/w/WorkOrderStatus.swift | 103 +++++++
Sources/App/Models/w/WorkOrderUser.swift | 99 +++++++
Sources/App/Models/x/XCustomerMachine.swift | 100 +++++++
Sources/App/Models/x/XFluidViscosity.swift | 98 +++++++
Sources/App/Models/x/XItemResponseType.swift | 96 +++++++
Sources/App/Models/x/XUserModule.swift | 108 +++++++
Sources/App/Models/x/XUserRole.swift | 93 ++++++
Sources/App/configure.swift | 124 ++++++++
Sources/App/routes.swift | 88 ++++++
Sources/Run/main.swift | 9 +
Tests/AppTests/AppTests.swift | 15 +
docker-compose.yml | 74 +++++
174 files changed, 22551 insertions(+)
create mode 100644 .DS_Store
create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
create mode 100644 .swiftpm/xcode/package.xcworkspace/xcuserdata/michielcarman.xcuserdatad/UserInterfaceState.xcuserstate
create mode 100644 .swiftpm/xcode/xcuserdata/michielcarman.xcuserdatad/xcschemes/xcschememanagement.plist
create mode 100644 Dockerfile
create mode 100644 Package.resolved
create mode 100644 Package.swift
create mode 100644 Resources/Views/index.leaf
create mode 100644 Sources/.DS_Store
create mode 100644 Sources/App/.DS_Store
create mode 100644 Sources/App/Controllers/.gitkeep
create mode 100644 Sources/App/Controllers/c/CPCLTemplateCommandCtrl.swift
create mode 100644 Sources/App/Controllers/c/CPCLTemplateCtrl.swift
create mode 100644 Sources/App/Controllers/c/CategoryCtrl.swift
create mode 100644 Sources/App/Controllers/c/ComparisonTypeCtrl.swift
create mode 100644 Sources/App/Controllers/c/CompartmentCtrl.swift
create mode 100644 Sources/App/Controllers/c/CompartmentGroupCtrl.swift
create mode 100644 Sources/App/Controllers/c/CompartmentLocationCtrl.swift
create mode 100644 Sources/App/Controllers/c/ContactCtrl.swift
create mode 100644 Sources/App/Controllers/c/ContactMethodCtrl.swift
create mode 100644 Sources/App/Controllers/c/CustomerCtrl.swift
create mode 100644 Sources/App/Controllers/d/DataTypeCtrl.swift
create mode 100644 Sources/App/Controllers/d/DivisionCtrl.swift
create mode 100644 Sources/App/Controllers/f/FileCtrl.swift
create mode 100644 Sources/App/Controllers/f/FluidCtrl.swift
create mode 100644 Sources/App/Controllers/f/FuelLevelCtrl.swift
create mode 100644 Sources/App/Controllers/g/GateCtrl.swift
create mode 100644 Sources/App/Controllers/i/IncompleteReasonCtrl.swift
create mode 100644 Sources/App/Controllers/i/InputTypeCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemResponseTypeCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemSpecCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemSpecItemCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemSpecItemTestCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCategoryItemSpecItemValueCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionLevelCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionTypeCtrl.swift
create mode 100644 Sources/App/Controllers/i/InspectionUserCtrl.swift
create mode 100644 Sources/App/Controllers/i/ItemCtrl.swift
create mode 100644 Sources/App/Controllers/j/JobSiteCtrl.swift
create mode 100644 Sources/App/Controllers/l/LabSettingCtrl.swift
create mode 100644 Sources/App/Controllers/l/LevelCtrl.swift
create mode 100644 Sources/App/Controllers/l/LicenseCtrl.swift
create mode 100644 Sources/App/Controllers/l/LocationCtrl.swift
create mode 100644 Sources/App/Controllers/m/MachineCtrl.swift
create mode 100644 Sources/App/Controllers/m/MachineMeterCtrl.swift
create mode 100644 Sources/App/Controllers/m/MachineNumberCtrl.swift
create mode 100644 Sources/App/Controllers/m/MachineTypeCtrl.swift
create mode 100644 Sources/App/Controllers/m/MakeCtrl.swift
create mode 100644 Sources/App/Controllers/m/ModelCtrl.swift
create mode 100644 Sources/App/Controllers/m/ModuleCtrl.swift
create mode 100644 Sources/App/Controllers/n/NoteCtrl.swift
create mode 100644 Sources/App/Controllers/n/NoteTypeCtrl.swift
create mode 100644 Sources/App/Controllers/o/OilSampleCtrl.swift
create mode 100644 Sources/App/Controllers/o/OilSampleItemCtrl.swift
create mode 100644 Sources/App/Controllers/o/OilSampleLabelCtrl.swift
create mode 100644 Sources/App/Controllers/p/PartCtrl.swift
create mode 100644 Sources/App/Controllers/p/PriorityCtrl.swift
create mode 100644 Sources/App/Controllers/p/ProductCtrl.swift
create mode 100644 Sources/App/Controllers/r/ReasonCtrl.swift
create mode 100644 Sources/App/Controllers/r/RepairTypeCtrl.swift
create mode 100644 Sources/App/Controllers/r/ResponseTypeCtrl.swift
create mode 100644 Sources/App/Controllers/r/RoleCtrl.swift
create mode 100644 Sources/App/Controllers/s/SignatureCtrl.swift
create mode 100644 Sources/App/Controllers/s/SignatureTypeCtrl.swift
create mode 100644 Sources/App/Controllers/s/SpecCtrl.swift
create mode 100644 Sources/App/Controllers/s/SpecItemCtrl.swift
create mode 100644 Sources/App/Controllers/s/SpecItemValueCtrl.swift
create mode 100644 Sources/App/Controllers/s/StatusCtrl.swift
create mode 100644 Sources/App/Controllers/t/TemplateCategoryCtrl.swift
create mode 100644 Sources/App/Controllers/t/TemplateCategoryItemCtrl.swift
create mode 100644 Sources/App/Controllers/t/TemplateCategoryItemSpecCtrl.swift
create mode 100644 Sources/App/Controllers/t/TemplateCtrl.swift
create mode 100644 Sources/App/Controllers/u/UnitCtrl.swift
create mode 100644 Sources/App/Controllers/u/UserCtrl.swift
create mode 100644 Sources/App/Controllers/u/UserDefinedCodeCtrl.swift
create mode 100644 Sources/App/Controllers/v/ValueTypeCtrl.swift
create mode 100644 Sources/App/Controllers/v/ViscosityCtrl.swift
create mode 100644 Sources/App/Controllers/w/WorkOrderCtrl.swift
create mode 100644 Sources/App/Controllers/w/WorkOrderStatusCtrl.swift
create mode 100644 Sources/App/Controllers/w/WorkOrderUserCtrl.swift
create mode 100644 Sources/App/Controllers/x/XCustomerMachineCtrl.swift
create mode 100644 Sources/App/Controllers/x/XFluidViscosityCtrl.swift
create mode 100644 Sources/App/Controllers/x/XItemResponseTypeCtrl.swift
create mode 100644 Sources/App/Controllers/x/XUserModuleCtrl.swift
create mode 100644 Sources/App/Controllers/x/XUserRoleCtrl.swift
create mode 100644 Sources/App/Migrations/TableCreationOrdermd
create mode 100644 Sources/App/Models/c/CPCLTemplate.swift
create mode 100644 Sources/App/Models/c/CPCLTemplateCommand.swift
create mode 100644 Sources/App/Models/c/Category.swift
create mode 100644 Sources/App/Models/c/ComparisonType.swift
create mode 100644 Sources/App/Models/c/Compartment.swift
create mode 100644 Sources/App/Models/c/CompartmentGroup.swift
create mode 100644 Sources/App/Models/c/CompartmentLocation.swift
create mode 100644 Sources/App/Models/c/Consumption.swift
create mode 100644 Sources/App/Models/c/ConsumptionItem.swift
create mode 100644 Sources/App/Models/c/Contact.swift
create mode 100644 Sources/App/Models/c/ContactMethod.swift
create mode 100644 Sources/App/Models/c/Customer.swift
create mode 100644 Sources/App/Models/d/DataType.swift
create mode 100644 Sources/App/Models/d/Division.swift
create mode 100644 Sources/App/Models/f/File.swift
create mode 100644 Sources/App/Models/f/Fluid.swift
create mode 100644 Sources/App/Models/f/FuelLevel.swift
create mode 100644 Sources/App/Models/g/Gate.swift
create mode 100644 Sources/App/Models/i/IncompleteReason.swift
create mode 100644 Sources/App/Models/i/InputType.swift
create mode 100644 Sources/App/Models/i/Inspection.swift
create mode 100644 Sources/App/Models/i/InspectionCategory.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItem.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItemResponseType.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItemSpec.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItemSpecItem.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItemSpecItemTest.swift
create mode 100644 Sources/App/Models/i/InspectionCategoryItemSpecItemValue.swift
create mode 100644 Sources/App/Models/i/InspectionLevel.swift
create mode 100644 Sources/App/Models/i/InspectionType.swift
create mode 100644 Sources/App/Models/i/InspectionUser.swift
create mode 100644 Sources/App/Models/i/Item.swift
create mode 100644 Sources/App/Models/j/JobSite.swift
create mode 100644 Sources/App/Models/l/LabSetting.swift
create mode 100644 Sources/App/Models/l/Level.swift
create mode 100644 Sources/App/Models/l/License.swift
create mode 100644 Sources/App/Models/l/Location.swift
create mode 100644 Sources/App/Models/m/Machine.swift
create mode 100644 Sources/App/Models/m/MachineMeter.swift
create mode 100644 Sources/App/Models/m/MachineNumber.swift
create mode 100644 Sources/App/Models/m/MachineType.swift
create mode 100644 Sources/App/Models/m/Make.swift
create mode 100644 Sources/App/Models/m/Model.swift
create mode 100644 Sources/App/Models/m/Module.swift
create mode 100644 Sources/App/Models/n/Note.swift
create mode 100644 Sources/App/Models/n/NoteType.swift
create mode 100644 Sources/App/Models/o/OilSample.swift
create mode 100644 Sources/App/Models/o/OilSampleItem.swift
create mode 100644 Sources/App/Models/o/OilSampleLabel.swift
create mode 100644 Sources/App/Models/p/Part.swift
create mode 100644 Sources/App/Models/p/Priority.swift
create mode 100644 Sources/App/Models/p/Product.swift
create mode 100644 Sources/App/Models/r/Reason.swift
create mode 100644 Sources/App/Models/r/RepairType.swift
create mode 100644 Sources/App/Models/r/ResponseType.swift
create mode 100644 Sources/App/Models/r/Role.swift
create mode 100644 Sources/App/Models/s/Signature.swift
create mode 100644 Sources/App/Models/s/SignatureType.swift
create mode 100644 Sources/App/Models/s/Spec.swift
create mode 100644 Sources/App/Models/s/SpecItem.swift
create mode 100644 Sources/App/Models/s/SpecItemValue.swift
create mode 100644 Sources/App/Models/s/Status.swift
create mode 100644 Sources/App/Models/t/Template.swift
create mode 100644 Sources/App/Models/t/TemplateCategory.swift
create mode 100644 Sources/App/Models/t/TemplateCategoryItem.swift
create mode 100644 Sources/App/Models/t/TemplateCategoryItemSpec.swift
create mode 100644 Sources/App/Models/u/Unit.swift
create mode 100644 Sources/App/Models/u/User.swift
create mode 100644 Sources/App/Models/u/UserDefinedCode.swift
create mode 100644 Sources/App/Models/v/ValueType.swift
create mode 100644 Sources/App/Models/v/Viscosity.swift
create mode 100644 Sources/App/Models/w/WokrOrder.swift
create mode 100644 Sources/App/Models/w/WorkOrderPart.swift
create mode 100644 Sources/App/Models/w/WorkOrderStatus.swift
create mode 100644 Sources/App/Models/w/WorkOrderUser.swift
create mode 100644 Sources/App/Models/x/XCustomerMachine.swift
create mode 100644 Sources/App/Models/x/XFluidViscosity.swift
create mode 100644 Sources/App/Models/x/XItemResponseType.swift
create mode 100644 Sources/App/Models/x/XUserModule.swift
create mode 100644 Sources/App/Models/x/XUserRole.swift
create mode 100644 Sources/App/configure.swift
create mode 100644 Sources/App/routes.swift
create mode 100644 Sources/Run/main.swift
create mode 100644 Tests/AppTests/AppTests.swift
create mode 100644 docker-compose.yml
diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..c2e5d02b24f030bb66937fbc7d7b90fca29b6a7b
GIT binary patch
literal 6148
zcmeHKF;2rk5ZnVJ0%=lG`UOP!feGdVga;reC_zf(C?vf_2Mvfa51{7@zyqLxf-(i)
zV0Q0Fe6f=fp=ejSoAd4N-FPJ5`iRIhC!GdSjfg5}jKMy-5@SENf^E4OPBy$ozuRcF
z)4{M1sS~PzD)1i_kPn{@sY{nM_P^ic9fX5l-yn_Sq@O03t9)F~M&a%2k?-%U^$&Zw
zv%$Qv7JGC`7j#7_O=v`I9{UXFt~@HwWqe$}pFO-Vmy-1c>4MezNROYKhqOzrmE5YI
z&)9J(BG2n-ntVM@g;ybJ!D)4r$ETKIGuoju(QCY{lezJ|c^=>Oxjwo4ye{Pt-u_k(
z=AgDY3ZQ1QRjL-XR|Ql7RbZ|FpAR7#W8^TiC`Si6xdH$KOp9U6zZ9GkI*c4<7U6*z
zn+mk4#$7RtD>cTZ!ymc$%%V*vBRgXqx3h6K6eGK1K9q1WkwxuQ0ad_PVB0>{xc;B4
zzW@74`lJe|0vn}(3F21V#4EYlT6j6GwISL$8XL!D79|CpE5|b6Qhb0W24BbnVB|2f
Rh#8pv2#5^YsRDnhzz=sdkH`Q3
literal 0
HcmV?d00001
diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/michielcarman.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/michielcarman.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000000000000000000000000000000000000..288c999f9691b5ab6b6f54c9f47112d62f0c379a
GIT binary patch
literal 14361
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
literal 0
HcmV?d00001
diff --git a/.swiftpm/xcode/xcuserdata/michielcarman.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/michielcarman.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..d7c4001
--- /dev/null
+++ b/.swiftpm/xcode/xcuserdata/michielcarman.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,14 @@
+
+
+
+
+ SchemeUserState
+
+ connexion_services.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+
+
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..d0af8ad
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,65 @@
+# ================================
+# Build image
+# ================================
+FROM swift:5.4-focal as build
+
+# Install OS updates and, if needed, sqlite3
+RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
+ && apt-get -q update \
+ && apt-get -q dist-upgrade -y \
+ && rm -rf /var/lib/apt/lists/*
+
+# Set up a build area
+WORKDIR /build
+
+# First just resolve dependencies.
+# This creates a cached layer that can be reused
+# as long as your Package.swift/Package.resolved
+# files do not change.
+COPY ./Package.* ./
+RUN swift package resolve
+
+# Copy entire repo into container
+COPY . .
+
+# Build everything, with optimizations
+RUN swift build -c release
+
+# Switch to the staging area
+WORKDIR /staging
+
+# Copy main executable to staging area
+RUN cp "$(swift build --package-path /build -c release --show-bin-path)/Run" ./
+
+# Copy any resouces from the public directory and views directory if the directories exist
+# Ensure that by default, neither the directory nor any of its contents are writable.
+RUN [ -d /build/Public ] && { mv /build/Public ./Public && chmod -R a-w ./Public; } || true
+RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w ./Resources; } || true
+
+# ================================
+# Run image
+# ================================
+FROM swift:5.4-focal-slim
+
+# Make sure all system packages are up to date.
+RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && \
+ apt-get -q update && apt-get -q dist-upgrade -y && rm -r /var/lib/apt/lists/*
+
+# Create a vapor user and group with /app as its home directory
+RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
+
+# Switch to the new home directory
+WORKDIR /app
+
+# Copy built executable and any staged resources from builder
+COPY --from=build --chown=vapor:vapor /staging /app
+
+# Ensure all further commands run as the vapor user
+USER vapor:vapor
+
+# Let Docker bind to port 8080
+EXPOSE 8080
+
+# Start the Vapor service when the image is run, default to listening on 8080 in production environment
+ENTRYPOINT ["./Run"]
+CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
diff --git a/Package.resolved b/Package.resolved
new file mode 100644
index 0000000..4212869
--- /dev/null
+++ b/Package.resolved
@@ -0,0 +1,205 @@
+{
+ "object": {
+ "pins": [
+ {
+ "package": "async-http-client",
+ "repositoryURL": "https://github.com/swift-server/async-http-client.git",
+ "state": {
+ "branch": null,
+ "revision": "1081b0b0541f535ca088acdb56f5ca5598bc6247",
+ "version": "1.6.3"
+ }
+ },
+ {
+ "package": "async-kit",
+ "repositoryURL": "https://github.com/vapor/async-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "f6f92e6d3704bd72ffb4d00e302c98476fe65854",
+ "version": "1.9.0"
+ }
+ },
+ {
+ "package": "console-kit",
+ "repositoryURL": "https://github.com/vapor/console-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "75ea3b627d88221440b878e5dfccc73fd06842ed",
+ "version": "4.2.7"
+ }
+ },
+ {
+ "package": "fluent",
+ "repositoryURL": "https://github.com/vapor/fluent.git",
+ "state": {
+ "branch": null,
+ "revision": "5810a409eb0271a576f68887fa6713dae3985056",
+ "version": "4.3.1"
+ }
+ },
+ {
+ "package": "fluent-kit",
+ "repositoryURL": "https://github.com/vapor/fluent-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "06a6939ff486cb6abae08b2e025b02291cff0da0",
+ "version": "1.15.3"
+ }
+ },
+ {
+ "package": "fluent-postgres-driver",
+ "repositoryURL": "https://github.com/vapor/fluent-postgres-driver.git",
+ "state": {
+ "branch": null,
+ "revision": "0b7a43c78b7ae47eafad5736ab0fdc00aa31ca6f",
+ "version": "2.2.1"
+ }
+ },
+ {
+ "package": "multipart-kit",
+ "repositoryURL": "https://github.com/vapor/multipart-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "82f255699b1de9ba1f34dfc6b99e99aba5a1f8eb",
+ "version": "4.5.0"
+ }
+ },
+ {
+ "package": "postgres-kit",
+ "repositoryURL": "https://github.com/vapor/postgres-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "a050d338b41531bff65bccc87cf2a42871e87ff5",
+ "version": "2.3.3"
+ }
+ },
+ {
+ "package": "postgres-nio",
+ "repositoryURL": "https://github.com/vapor/postgres-nio.git",
+ "state": {
+ "branch": null,
+ "revision": "c5eda6cebfdb81959f96d4ad8fcb1e8fc4596a52",
+ "version": "1.6.3"
+ }
+ },
+ {
+ "package": "routing-kit",
+ "repositoryURL": "https://github.com/vapor/routing-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "a0801a36a6ad501d5ad6285cbcd4774de6b0a734",
+ "version": "4.3.0"
+ }
+ },
+ {
+ "package": "sql-kit",
+ "repositoryURL": "https://github.com/vapor/sql-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "8587674e7e2499fd2017840973f416182025b02d",
+ "version": "3.12.1"
+ }
+ },
+ {
+ "package": "swift-backtrace",
+ "repositoryURL": "https://github.com/swift-server/swift-backtrace.git",
+ "state": {
+ "branch": null,
+ "revision": "d3e04a9d4b3833363fb6192065b763310b156d54",
+ "version": "1.3.1"
+ }
+ },
+ {
+ "package": "swift-crypto",
+ "repositoryURL": "https://github.com/apple/swift-crypto.git",
+ "state": {
+ "branch": null,
+ "revision": "127d3745c37b5705e4bc8d16c7951c48dcc3332c",
+ "version": "2.0.0"
+ }
+ },
+ {
+ "package": "swift-log",
+ "repositoryURL": "https://github.com/apple/swift-log.git",
+ "state": {
+ "branch": null,
+ "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
+ "version": "1.4.2"
+ }
+ },
+ {
+ "package": "swift-metrics",
+ "repositoryURL": "https://github.com/apple/swift-metrics.git",
+ "state": {
+ "branch": null,
+ "revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff",
+ "version": "2.2.0"
+ }
+ },
+ {
+ "package": "swift-nio",
+ "repositoryURL": "https://github.com/apple/swift-nio.git",
+ "state": {
+ "branch": null,
+ "revision": "6aa9347d9bc5bbfe6a84983aec955c17ffea96ef",
+ "version": "2.33.0"
+ }
+ },
+ {
+ "package": "swift-nio-extras",
+ "repositoryURL": "https://github.com/apple/swift-nio-extras.git",
+ "state": {
+ "branch": null,
+ "revision": "f73ca5ee9c6806800243f1ac415fcf82de9a4c91",
+ "version": "1.10.2"
+ }
+ },
+ {
+ "package": "swift-nio-http2",
+ "repositoryURL": "https://github.com/apple/swift-nio-http2.git",
+ "state": {
+ "branch": null,
+ "revision": "326f7f9a8c8c8402e3691adac04911cac9f9d87f",
+ "version": "1.18.4"
+ }
+ },
+ {
+ "package": "swift-nio-ssl",
+ "repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
+ "state": {
+ "branch": null,
+ "revision": "5e68c1ded15619bb281b273fa8c2d8fd7f7b2b7d",
+ "version": "2.16.1"
+ }
+ },
+ {
+ "package": "swift-nio-transport-services",
+ "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
+ "state": {
+ "branch": null,
+ "revision": "e7f5278a26442dc46783ba7e063643d524e414a0",
+ "version": "1.11.3"
+ }
+ },
+ {
+ "package": "vapor",
+ "repositoryURL": "https://github.com/vapor/vapor.git",
+ "state": {
+ "branch": null,
+ "revision": "27119271502bf266be293be5325f0fb72435e8fd",
+ "version": "4.49.2"
+ }
+ },
+ {
+ "package": "websocket-kit",
+ "repositoryURL": "https://github.com/vapor/websocket-kit.git",
+ "state": {
+ "branch": null,
+ "revision": "b1c4df8f6c848c2e977726903bbe6578eed723ad",
+ "version": "2.2.0"
+ }
+ }
+ ]
+ },
+ "version": 1
+}
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..89cdebe
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,36 @@
+// swift-tools-version:5.2
+import PackageDescription
+
+let package = Package(
+ name: "connexion_services",
+ platforms: [
+ .macOS(.v10_15)
+ ],
+ dependencies: [
+ // 💧 A server-side Swift web framework.
+ .package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
+ .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
+ .package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),
+ ],
+ targets: [
+ .target(
+ name: "App",
+ dependencies: [
+ .product(name: "Fluent", package: "fluent"),
+ .product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"),
+ .product(name: "Vapor", package: "vapor")
+ ],
+ swiftSettings: [
+ // Enable better optimizations when building in Release configuration. Despite the use of
+ // the `.unsafeFlags` construct required by SwiftPM, this flag is recommended for Release
+ // builds. See for details.
+ .unsafeFlags(["-cross-module-optimization"], .when(configuration: .release))
+ ]
+ ),
+ .target(name: "Run", dependencies: [.target(name: "App")]),
+ .testTarget(name: "AppTests", dependencies: [
+ .target(name: "App"),
+ .product(name: "XCTVapor", package: "vapor"),
+ ])
+ ]
+)
diff --git a/Resources/Views/index.leaf b/Resources/Views/index.leaf
new file mode 100644
index 0000000..10cb4f7
--- /dev/null
+++ b/Resources/Views/index.leaf
@@ -0,0 +1,12 @@
+
+
+
+
+
+ #(title)
+
+
+
+ #(title)
+
+
\ No newline at end of file
diff --git a/Sources/.DS_Store b/Sources/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..886d6c6183dfb2f0f5d7c771a78880f219769223
GIT binary patch
literal 6148
zcmeHKJ5Iwu5S<}GvP9#O(h@yVZs0_wqCw;WC`5uH#%|L40!UFxT24VlLB%=fC^-Rd
zK44q1C?h~K((YT&+u2#aC_7#v;@NsRAxeoTK@(&d44AkFsRN%ZB+D9;`E^y+>OFGq
zw}b3`L{qA%Ufp!}|9sdoWmOc5RkeU8`FOoQe}8@?FxJ?t1x%
zo?51x@8sch^S1ST8dp|rzFoGLPk&cQ85RnJ0--=C5DI)NfSN6q{FPd5+l@XH2nF_`
zfSeB*nqcnO80yi1POkvKG2Chx%UwcZGRNGpF$4o+3k6yz`xS%zla(zTeD3obLklO?
z%vi@We_dW!v%{b1bmH7F`cNPg=qoU?$5iV78U8YZm;8Q6JcRCI|L4i*_
Cazexa
literal 0
HcmV?d00001
diff --git a/Sources/App/.DS_Store b/Sources/App/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..e6d78490858b32a1a88fe938e91023262bdf45c6
GIT binary patch
literal 6148
zcmeHKK~BOz6#avwDdK{qF)n%p@dOoX;>HyhP{bffu>@t`3%E2I*Pa0nz|zEc0u~;_
zmGA$VPzI>RjWOnbGV|J*_ouIK(iw(`Ol#b25;ce@L}9GdP^}5>=duzN*RlmPGRBB9
zO7Xj((F$7|{-OgscXc|%yj{@^X04dN>$KNwpJ#)i$PV5y!)44tmL#1t>wpm+&t~KB
zaeD9-yZZz7@Nz*#?Ty83(h2pc2eoI=+!yV>S_*f|c#B&1Kb|L(2hqBA%t2Nt{f_JD
zl<$cG=**~#uOTI0U-jt~`n>){T|3j4+xt7wwZtj(lyN*A!5;gip$@16>cFxCyrLt*
zx<#$k0d+tfm^;AhLxjQ@JIpQ0(t%2j0Kh7mC2-AW3C@We#tw6f=s_5p3bd)l9Wjhe
zM|0ORe^h?{_mlKa9Z(1U
zl>?@lw38NI$?dHxFUNargmQ|)!Mxn!JOvlB6@$xL@ivMC+9SRI#tw6fXhG;70kJ_V
Jb>LSW_yiI4eH;J)
literal 0
HcmV?d00001
diff --git a/Sources/App/Controllers/.gitkeep b/Sources/App/Controllers/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/Sources/App/Controllers/c/CPCLTemplateCommandCtrl.swift b/Sources/App/Controllers/c/CPCLTemplateCommandCtrl.swift
new file mode 100644
index 0000000..d4d003a
--- /dev/null
+++ b/Sources/App/Controllers/c/CPCLTemplateCommandCtrl.swift
@@ -0,0 +1,155 @@
+//
+// CPCLTemplateCommandCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/11/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CPCLTemplateCommandCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCPCLTemplateCommand.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCPCLTemplateCommand.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCPCLTemplateCommand.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CPCLTemplateCommandCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCPCLTemplateCommand.query(on: req.db).with(\.$cpcltemplate)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCPCLTemplateCommand) -> mdlCPCLTemplateCommand.Output {
+ return mdlCPCLTemplateCommand.Output(
+ id: output.id!,
+ cmd: output.cmd,
+ sortorder: output.sortorder,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ cpcltemplate: output.$cpcltemplate.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCPCLTemplateCommand.Input){
+ output.cmd = input.cmd;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$cpcltemplate.id = input.cpcltemplate.id!
+ }
+
+ func createUnit(_ input: mdlCPCLTemplateCommand.Input) -> mdlCPCLTemplateCommand {
+ return mdlCPCLTemplateCommand(
+ id: input.id ?? nil
+ , cmd: input.cmd
+ , sortorder: input.sortorder
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , cpcltemplate: input.cpcltemplate
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCPCLTemplateCommand.Output(
+ id: output.id!
+ , cmd: output.cmd
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , cpcltemplate: output.cpcltemplate
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCPCLTemplateCommand, _ req: Request, _ input: mdlCPCLTemplateCommand.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCPCLTemplateCommand.Output(
+ id: output.id!
+ , cmd: output.cmd
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , cpcltemplate: input.cpcltemplate
+ )
+
+ }
+ }
+
+}
+extension CPCLTemplateCommandCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("cpclcommands")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CPCLTemplateCtrl.swift b/Sources/App/Controllers/c/CPCLTemplateCtrl.swift
new file mode 100644
index 0000000..1bb4343
--- /dev/null
+++ b/Sources/App/Controllers/c/CPCLTemplateCtrl.swift
@@ -0,0 +1,157 @@
+//
+// CPCLTemplateCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/11/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CPCLTemplateCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCPCLTemplate.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCPCLTemplate.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCPCLTemplate.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CPCLTemplateCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCPCLTemplate.query(on: req.db)
+ .with(\.$oilsamplelabel)
+ .with(\.$commands)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCPCLTemplate) -> mdlCPCLTemplate.Output {
+ return mdlCPCLTemplate.Output(
+ id: output.id!,
+ name: output.name,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ oilsamplelabel: output.$oilsamplelabel.value!,
+ commands: output.$commands.value
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCPCLTemplate.Input){
+ output.name = input.name;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$oilsamplelabel.id = input.oilsamplelabel.id!;
+ output.$commands.value = input.commands
+ }
+
+ func createUnit(_ input: mdlCPCLTemplate.Input) -> mdlCPCLTemplate {
+ return mdlCPCLTemplate(
+ id: input.id ?? nil
+ , name: input.name
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , oilsamplelabel: input.oilsamplelabel
+ , commands: input.commands
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCPCLTemplate.Output(
+ id: output.id!
+ , name: output.name
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , oilsamplelabel: output.oilsamplelabel
+ , commands: output.commands
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCPCLTemplate, _ req: Request, _ input: mdlCPCLTemplate.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCPCLTemplate.Output(
+ id: output.id!
+ , name: output.name
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , oilsamplelabel: input.oilsamplelabel
+ , commands: input.commands
+ )
+
+ }
+ }
+
+}
+extension CPCLTemplateCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("cpcltemplates")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CategoryCtrl.swift b/Sources/App/Controllers/c/CategoryCtrl.swift
new file mode 100644
index 0000000..fd7324b
--- /dev/null
+++ b/Sources/App/Controllers/c/CategoryCtrl.swift
@@ -0,0 +1,155 @@
+//
+// CategoryCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/9/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CategoryCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCategory.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCategory.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCategory.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CategoryCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCategory.query(on: req.db).with(\.$items)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCategory) -> mdlCategory.Output {
+ return mdlCategory.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ items: output.$items.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCategory.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$items.value = input.items
+ }
+
+ func createUnit(_ input: mdlCategory.Input) -> mdlCategory {
+ return mdlCategory(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , items: input.items
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCategory.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , items: output.items
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCategory, _ req: Request, _ input: mdlCategory.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCategory.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , items: input.items
+ )
+
+ }
+ }
+
+}
+extension CategoryCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("categories")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/ComparisonTypeCtrl.swift b/Sources/App/Controllers/c/ComparisonTypeCtrl.swift
new file mode 100644
index 0000000..f096359
--- /dev/null
+++ b/Sources/App/Controllers/c/ComparisonTypeCtrl.swift
@@ -0,0 +1,154 @@
+//
+// ComparisonTypeCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class ComparisonTypeCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlComparisonType.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlComparisonType.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlComparisonType.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension ComparisonTypeCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlComparisonType.query(on: req.db).with(\.$specitems).with(\.$inspectioncategoryitemspecitems)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlComparisonType) -> mdlComparisonType.Output {
+ return mdlComparisonType.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ specitems: output.$specitems.value!,
+ inspectioncategoryitemspecitems: output.$inspectioncategoryitemspecitems.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlComparisonType.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$specitems.value = input.specitems;
+ output.$inspectioncategoryitemspecitems.value = input.inspectioncategoryitemspecitems
+ }
+
+ func createUnit(_ input: mdlComparisonType.Input) -> mdlComparisonType {
+ return mdlComparisonType(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , specitems: input.specitems
+ , inspectioncategoryitemspecitems: input.inspectioncategoryitemspecitems
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlComparisonType.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , specitems: output.specitems
+ , inspectioncategoryitemspecitems: output.inspectioncategoryitemspecitems
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlComparisonType, _ req: Request, _ input: mdlComparisonType.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlComparisonType.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , specitems: input.specitems
+ , inspectioncategoryitemspecitems: input.inspectioncategoryitemspecitems
+ )
+ }
+ }
+
+}
+extension ComparisonTypeCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("comparisontypes")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CompartmentCtrl.swift b/Sources/App/Controllers/c/CompartmentCtrl.swift
new file mode 100644
index 0000000..ca31e27
--- /dev/null
+++ b/Sources/App/Controllers/c/CompartmentCtrl.swift
@@ -0,0 +1,160 @@
+//
+// CompartmentCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CompartmentCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartment.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartment.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCompartment.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CompartmentCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCompartment.query(on: req.db)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCompartment) -> mdlCompartment.Output {
+ return mdlCompartment.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ code: output.code,
+ sortorder: output.sortorder,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCompartment.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.code = input.code;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ }
+
+ func createUnit(_ input: mdlCompartment.Input) -> mdlCompartment {
+ return mdlCompartment(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , code: input.code
+ , sortorder: input.sortorder
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCompartment.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , code: output.code
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCompartment, _ req: Request, _ input: mdlCompartment.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCompartment.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , code: output.code
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+
+ }
+ }
+
+}
+extension CompartmentCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("compartments")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CompartmentGroupCtrl.swift b/Sources/App/Controllers/c/CompartmentGroupCtrl.swift
new file mode 100644
index 0000000..2b2865a
--- /dev/null
+++ b/Sources/App/Controllers/c/CompartmentGroupCtrl.swift
@@ -0,0 +1,155 @@
+//
+// CompartmentGroupCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CompartmentGroupCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartmentGroup.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartmentGroup.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCompartmentGroup.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CompartmentGroupCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCompartmentGroup.query(on: req.db)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCompartmentGroup) -> mdlCompartmentGroup.Output {
+ return mdlCompartmentGroup.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ sortorder: output.sortorder,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCompartmentGroup.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ }
+
+ func createUnit(_ input: mdlCompartmentGroup.Input) -> mdlCompartmentGroup {
+ return mdlCompartmentGroup(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , sortorder: input.sortorder
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCompartmentGroup.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCompartmentGroup, _ req: Request, _ input: mdlCompartmentGroup.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCompartmentGroup.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+
+ }
+ }
+
+}
+extension CompartmentGroupCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("compartmentgroups")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CompartmentLocationCtrl.swift b/Sources/App/Controllers/c/CompartmentLocationCtrl.swift
new file mode 100644
index 0000000..27b8417
--- /dev/null
+++ b/Sources/App/Controllers/c/CompartmentLocationCtrl.swift
@@ -0,0 +1,161 @@
+//
+// CompartmentLocationCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CompartmentLocationCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartmentLocation.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCompartmentLocation.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCompartmentLocation.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CompartmentLocationCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCompartmentLocation.query(on: req.db)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCompartmentLocation) -> mdlCompartmentLocation.Output {
+ return mdlCompartmentLocation.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ code: output.code,
+ sortorder: output.sortorder,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCompartmentLocation.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.code = input.code;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ }
+
+ func createUnit(_ input: mdlCompartmentLocation.Input) -> mdlCompartmentLocation {
+ return mdlCompartmentLocation(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , code: input.code
+
+ , sortorder: input.sortorder
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCompartmentLocation.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , code: output.code
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCompartmentLocation, _ req: Request, _ input: mdlCompartmentLocation.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCompartmentLocation.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , code: output.code
+ , sortorder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+
+ }
+ }
+
+}
+extension CompartmentLocationCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("compartmentlocations")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/ContactCtrl.swift b/Sources/App/Controllers/c/ContactCtrl.swift
new file mode 100644
index 0000000..aa6bcb5
--- /dev/null
+++ b/Sources/App/Controllers/c/ContactCtrl.swift
@@ -0,0 +1,170 @@
+//
+// ContractCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/5/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class ContactCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlContact.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlContact.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlContact.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension ContactCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlContact.query(on: req.db).with(\.$customer).with(\.$location).with(\.$contacttypes).with(\.$files)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlContact) -> mdlContact.Output {
+ return mdlContact.Output(
+ id: output.id!,
+ firstname: output.firstname,
+ lastname: output.lastname,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ customer: output.$customer.value!,
+ location: output.$location.value!,
+ contacttypes: output.$contacttypes.value!,
+ files: output.$files.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlContact.Input){
+ output.firstname = input.firstname;
+ output.lastname = input.lastname;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$customer.id = input.customer.id!;
+ output.$location.id = input.location.id!;
+ output.$contacttypes.value = input.contacttypes;
+ output.$files.value = input.files
+ }
+
+ func createUnit(_ input: mdlContact.Input) -> mdlContact {
+ return mdlContact(
+ id: input.id ?? nil
+ , firstname: input.firstname
+ , lastname: input.lastname
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , customer: input.customer
+ , location: input.location
+ , contacttypes: input.contacttypes
+ , files: input.files
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlContact.Output(
+ id: output.id!
+ , firstname: output.firstname
+ , lastname: output.lastname
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , customer: output.customer
+ , location: output.location
+ , contacttypes: output.contacttypes
+ , files: output.files
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlContact, _ req: Request, _ input: mdlContact.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlContact.Output(
+ id: output.id!
+ , firstname: output.firstname
+ , lastname: output.lastname
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , customer: input.customer
+ , location: input.location
+ , contacttypes: input.contacttypes
+ , files: input.files
+ )
+
+ }
+ }
+
+}
+extension ContactCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("contacts")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/ContactMethodCtrl.swift b/Sources/App/Controllers/c/ContactMethodCtrl.swift
new file mode 100644
index 0000000..7be246f
--- /dev/null
+++ b/Sources/App/Controllers/c/ContactMethodCtrl.swift
@@ -0,0 +1,174 @@
+//
+// ContactMethodCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/5/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class ContactMethodCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlContactMethod.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlContactMethod.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlContactMethod.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension ContactMethodCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlContactMethod.query(on: req.db).with(\.$contact)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlContactMethod) -> mdlContactMethod.Output {
+ return mdlContactMethod.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ line1: output.line1,
+ line2: output.line2,
+ line3: output.line3,
+ line4: output.line4,
+ primary: output.primary,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ contact: output.$contact.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlContactMethod.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.line1 = input.line1;
+ output.line2 = input.line2;
+ output.line3 = input.line3;
+ output.line4 = input.line4;
+ output.primary = input.primary;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$contact.id = input.contact.id!
+ }
+
+ func createUnit(_ input: mdlContactMethod.Input) -> mdlContactMethod {
+ return mdlContactMethod(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , line1: input.line1
+ , line2: input.line2
+ , line3: input.line3
+ , line4: input.line4
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , contact: input.contact
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlContactMethod.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , line1: output.line1
+ , line2: output.line2
+ , line3: output.line3
+ , line4: output.line4
+ , primary: output.primary
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , contact: output.contact
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlContactMethod, _ req: Request, _ input: mdlContactMethod.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlContactMethod.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , line1: output.line1
+ , line2: output.line2
+ , line3: output.line3
+ , line4: output.line4
+ , primary: output.primary
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , contact: input.contact
+ )
+
+ }
+ }
+
+}
+extension ContactMethodCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("contactmethods")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/c/CustomerCtrl.swift b/Sources/App/Controllers/c/CustomerCtrl.swift
new file mode 100644
index 0000000..cf9931e
--- /dev/null
+++ b/Sources/App/Controllers/c/CustomerCtrl.swift
@@ -0,0 +1,214 @@
+//
+// CustomerCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class CustomerCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCustomer.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlCustomer.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlCustomer.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension CustomerCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlCustomer.query(on: req.db)
+ .with(\.$contacts)
+ .with(\.$templates)
+ .with(\.$workorders)
+ .with(\.$machines)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlCustomer) -> mdlCustomer.Output {
+ return mdlCustomer.Output(
+ id: output.id!,
+ number: output.number,
+ name: output.name,
+ address: output.address,
+ address2: output.address2,
+ city: output.city,
+ state: output.state,
+ zip: output.zip,
+ phone1: output.phone1,
+ phone2: output.phone2,
+ fax: output.fax,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ contacts: output.contacts,
+ machines: output.machines,
+ templates: output.templates,
+ workorders: output.workorders
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlCustomer.Input){
+ output.number = input.number;
+ output.name = input.name;
+ output.address = input.address;
+ output.address2 = input.address2;
+ output.city = input.city;
+ output.state = input.state;
+ output.zip = input.zip;
+ output.phone1 = input.phone1;
+ output.phone2 = input.phone2;
+ output.fax = input.fax;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$contacts.value = input.contacts;
+ output.$machines.value = input.machines;
+ output.$templates.value = input.templates;
+ output.$workorders.value = input.workorders
+ }
+
+ func createUnit(_ input: mdlCustomer.Input) -> mdlCustomer {
+ return mdlCustomer(
+ id: input.id ?? nil
+ , number: input.number
+ , name: input.name
+ , address: input.address
+ , address2: input.address2
+ , city: input.city
+ , state: input.state
+ , zip: input.zip
+ , phone1: input.phone1
+ , phone2: input.phone2
+ , fax: input.fax
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , contacts: input.contacts
+ , machines: input.machines
+ , templates: input.templates
+ , workorders: input.workorders
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlCustomer.Output(
+ id: output.id!
+ , number: output.number
+ , name: output.name
+ , address: output.address
+ , address2: output.address2
+ , city: output.city
+ , state: output.state
+ , zip: output.zip
+ , phone1: output.phone1
+ , phone2: output.phone2
+ , fax: output.fax
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , contacts: output.contacts
+ , machines: output.machines
+ , templates: output.templates
+ , workorders: output.workorders
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlCustomer, _ req: Request, _ input: mdlCustomer.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlCustomer.Output(
+ id: output.id!
+ , number: output.number
+ , name: output.name
+ , address: output.address
+ , address2: output.address2
+ , city: output.city
+ , state: output.state
+ , zip: output.zip
+ , phone1: output.phone1
+ , phone2: output.phone2
+ , fax: output.fax
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , contacts: input.contacts
+ , machines: input.machines
+ , templates: input.templates
+ , workorders: input.workorders
+ )
+
+ }
+ }
+
+}
+extension CustomerCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("customers")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/d/DataTypeCtrl.swift b/Sources/App/Controllers/d/DataTypeCtrl.swift
new file mode 100644
index 0000000..c25f81c
--- /dev/null
+++ b/Sources/App/Controllers/d/DataTypeCtrl.swift
@@ -0,0 +1,130 @@
+//
+// DataTypeCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/2/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class DataTypeCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlDataType.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlDataType.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlDataType.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+
+extension DataTypeCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlDataType.query(on: req.db).with(\.$units)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlDataType) -> mdlDataType.Output {
+ return mdlDataType.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , units: output.$units.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlDataType.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.$units.value = input.units
+ }
+
+ func createUnit(_ input: mdlDataType.Input) -> mdlDataType {
+ return mdlDataType(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , units: input.units
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlDataType.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , units: output.units
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlDataType, _ req: Request, _ input: mdlDataType.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlDataType.Output(
+ id: output.id!
+ , name: input.name
+ , description: input.description
+ , units: input.units
+ )
+ }
+ }
+
+ }
+ extension DataTypeCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("datatypes")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+ }
diff --git a/Sources/App/Controllers/d/DivisionCtrl.swift b/Sources/App/Controllers/d/DivisionCtrl.swift
new file mode 100644
index 0000000..a64fe13
--- /dev/null
+++ b/Sources/App/Controllers/d/DivisionCtrl.swift
@@ -0,0 +1,157 @@
+//
+// Division.swift
+//
+//
+// Created by Michiel Carman on 11/2/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class DivisionCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlDivision.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlDivision.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlDivision.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+
+extension DivisionCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlDivision.query(on: req.db).with(\.$users)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlDivision) -> mdlDivision.Output {
+ return mdlDivision.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ users: output.$users.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlDivision.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$users.value = input.users
+ }
+
+ func createUnit(_ input: mdlDivision.Input) -> mdlDivision {
+ return mdlDivision(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , users: input.users
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlDivision.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , users: output.users
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlDivision, _ req: Request, _ input: mdlDivision.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlDivision.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , users: output.users
+ )
+
+ }
+ }
+
+}
+ extension DivisionCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("divisions")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+ }
+
diff --git a/Sources/App/Controllers/f/FileCtrl.swift b/Sources/App/Controllers/f/FileCtrl.swift
new file mode 100644
index 0000000..1cc2f7a
--- /dev/null
+++ b/Sources/App/Controllers/f/FileCtrl.swift
@@ -0,0 +1,181 @@
+//
+// FileCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/12/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+import AppKit
+
+final class FileCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFile.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFile.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlFile.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension FileCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlFile.query(on: req.db)
+ .with(\.$workorder)
+ .with(\.$inspectioncategoryitem)
+ .with(\.$contact)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+
+ //create Output
+ func createRead(_ output: mdlFile) -> mdlFile.Output {
+ return mdlFile.Output(
+ id: output.id!
+ , name: output.name
+ , filepath: output.filepath
+ , filedata: String()
+
+ , filetype: output.filetype
+ , fileextension: output.fileextension
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , workorder: output.$workorder.value!
+ , inspectioncategoryitem: output.$inspectioncategoryitem.value!
+ , contact: output.$contact.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlFile.Input){
+ output.name = input.name;
+ output.filepath = input.filepath;
+ output.filetype = input.filetype;
+
+ output.fileextension = input.fileextension;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$workorder.id = input.workorder.id!;
+ output.$inspectioncategoryitem.id = input.inspectioncategoryitem.id!;
+ output.$contact.id = input.contact.id!;
+ }
+
+ func createUnit(_ input: mdlFile.Input) -> mdlFile {
+ return mdlFile(
+ id: input.id ?? nil
+ , name: input.name
+ , filepath: input.filepath
+ , filedata: input.filedata
+ , filetype: input.filetype
+ , fileextension: input.fileextension
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , workorder: input.workorder
+ , inspectioncategoryitem: input.inspectioncategoryitem
+ , contact: input.contact
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlFile.Output(
+ id: output.id!
+ , name: output.name
+ , filepath: output.filepath
+ , filedata: String()
+ , filetype: output.filetype
+ , fileextension: output.fileextension
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , workorder: output.workorder
+ , inspectioncategoryitem: output.inspectioncategoryitem
+ , contact: output.contact
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlFile, _ req: Request, _ input: mdlFile.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlFile.Output(
+ id: output.id!
+ , name: output.name
+ , filepath: output.filepath
+ , filedata: input.filedata
+ , filetype: output.filetype
+ , fileextension: output.fileextension
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , workorder: input.workorder
+ , inspectioncategoryitem: input.inspectioncategoryitem
+ , contact: input.contact
+ )
+
+ }
+ }
+
+}
+extension FileCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("files")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/f/FluidCtrl.swift b/Sources/App/Controllers/f/FluidCtrl.swift
new file mode 100644
index 0000000..1e14f76
--- /dev/null
+++ b/Sources/App/Controllers/f/FluidCtrl.swift
@@ -0,0 +1,160 @@
+//
+// FluidCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/9/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class FluidCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFluid.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFluid.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlFluid.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension FluidCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlFluid.query(on: req.db).with(\.$viscosities)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlFluid) -> mdlFluid.Output {
+ return mdlFluid.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ sortoder: output.sortorder,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ viscosities: output.$viscosities.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlFluid.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.sortorder = input.sortoder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$viscosities.value = input.viscosities
+ }
+
+ func createUnit(_ input: mdlFluid.Input) -> mdlFluid {
+ return mdlFluid(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , sortorder: input.sortoder
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , viscosities: input.viscosities
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlFluid.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortoder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , viscosities: output.viscosities
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlFluid, _ req: Request, _ input: mdlFluid.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlFluid.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortoder: output.sortorder
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , viscosities: input.viscosities
+ )
+
+ }
+ }
+
+}
+extension FluidCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("fluids")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/f/FuelLevelCtrl.swift b/Sources/App/Controllers/f/FuelLevelCtrl.swift
new file mode 100644
index 0000000..c3e41b7
--- /dev/null
+++ b/Sources/App/Controllers/f/FuelLevelCtrl.swift
@@ -0,0 +1,155 @@
+//
+// FuelLevelCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class FuelLevelCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFuelLevel.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlFuelLevel.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlFuelLevel.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension FuelLevelCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlFuelLevel.query(on: req.db)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlFuelLevel) -> mdlFuelLevel.Output {
+ return mdlFuelLevel.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ isactive: output.isactive,
+ sortorder: output.sortorder,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlFuelLevel.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ }
+
+ func createUnit(_ input: mdlFuelLevel.Input) -> mdlFuelLevel {
+ return mdlFuelLevel(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , isactive: input.isactive
+ , sortorder: input.sortorder
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlFuelLevel.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , sortorder: output.sortorder
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlFuelLevel, _ req: Request, _ input: mdlFuelLevel.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlFuelLevel.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , sortorder: output.sortorder
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ )
+
+ }
+ }
+
+}
+extension FuelLevelCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("fuellevels")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/g/GateCtrl.swift b/Sources/App/Controllers/g/GateCtrl.swift
new file mode 100644
index 0000000..2b031b0
--- /dev/null
+++ b/Sources/App/Controllers/g/GateCtrl.swift
@@ -0,0 +1,104 @@
+//
+// File.swift
+//
+//
+// Created by Michiel Carman on 11/2/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class GateCtrl{
+ //Create Division
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlGate.Input.self)
+ let output = buildObj(input)
+ return output.save(on: req.db).map{
+ self.buildObj(output)
+ }
+ }
+ //Update Division
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlGate.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).flatMap{output in self.buildObj(output, input)
+ return self.save(output, req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.buildObj($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.buildObj($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlGate.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+
+extension GateCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlGate.query(on: req.db).with(\.$location)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Input
+ func buildObj(_ input: mdlGate.Input) -> mdlGate {
+ return mdlGate(name: input.name, description: input.description, sortorder: input.sortorder, isactive: input.isactive, createuserid: input.createuserid, createdate: input.createdate, updateuserid: input.updateuserid, updatedate: input.updatedate, location: input.location)
+ }
+ //create Output
+ func buildObj(_ output: mdlGate) -> mdlGate.Output {
+ return mdlGate.Output(id: output.id!, name: output.name, description: output.description, sortorder: output.sortorder, isactive: output.isactive, createdate: output.createdate, createuserid: output.createuserid, updatedate: output.updatedate, updateuserid: output.updateuserid, location: output.location)
+ }
+
+ func buildObj(_ output: Optional.WrappedType, _ input: mdlGate.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.sortorder = input.sortorder;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.createuserid = input.createuserid;
+ output.updatedate = input.updatedate;
+ output.updateuserid = input.updateuserid;
+ output.location = input.location;
+ }
+
+ func save(_ output: mdlGate, _ req: Request) -> EventLoopFuture{
+ return output.save(on: req.db).map{self.buildObj(output)}
+ }
+
+}
+extension GateCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("gates")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/i/IncompleteReasonCtrl.swift b/Sources/App/Controllers/i/IncompleteReasonCtrl.swift
new file mode 100644
index 0000000..d40f627
--- /dev/null
+++ b/Sources/App/Controllers/i/IncompleteReasonCtrl.swift
@@ -0,0 +1,155 @@
+//
+// IncompleteReasonCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/5/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class IncompleteReasonCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlIncompleteReason.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlIncompleteReason.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlIncompleteReason.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension IncompleteReasonCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlIncompleteReason.query(on: req.db).with(\.$workorders)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlIncompleteReason) -> mdlIncompleteReason.Output {
+ return mdlIncompleteReason.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ workorders: output.$workorders.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlIncompleteReason.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$workorders.value = input.workorders
+ }
+
+ func createUnit(_ input: mdlIncompleteReason.Input) -> mdlIncompleteReason {
+ return mdlIncompleteReason(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , workorders: input.workorders
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlIncompleteReason.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , workorders: output.workorders
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlIncompleteReason, _ req: Request, _ input: mdlIncompleteReason.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlIncompleteReason.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , workorders: input.workorders
+ )
+
+ }
+ }
+
+}
+extension IncompleteReasonCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("incompletereaseons")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/i/InputTypeCtrl.swift b/Sources/App/Controllers/i/InputTypeCtrl.swift
new file mode 100644
index 0000000..2c9d248
--- /dev/null
+++ b/Sources/App/Controllers/i/InputTypeCtrl.swift
@@ -0,0 +1,130 @@
+//
+// InputTypeCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/4/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class InputTypeCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInputType.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInputType.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlInputType.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension InputTypeCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlInputType.query(on: req.db).with(\.$items).with(\.$inspectioncategoryitems)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlInputType) -> mdlInputType.Output {
+ return mdlInputType.Output(
+ id: output.id!,
+ name: output.name,
+ items: output.$items.value!,
+ inspectioncategoryitems: output.$inspectioncategoryitems.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlInputType.Input){
+ output.name = input.name;
+ output.$items.value = input.items!;
+ output.$inspectioncategoryitems.value = input.inspectioncategoryitems!
+ }
+
+ func createUnit(_ input: mdlInputType.Input) -> mdlInputType {
+ return mdlInputType(
+ id: input.id ?? nil
+ , name: input.name
+ , items: input.items
+ , inspectioncategoryitems: input.inspectioncategoryitems
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlInputType.Output(
+ id: output.id!
+ , name: output.name
+ , items: output.items
+ , inspectioncategoryitems: output.inspectioncategoryitems
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlInputType, _ req: Request, _ input: mdlInputType.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlInputType.Output(
+ id: output.id!
+ , name: output.name
+ , items: input.items
+ , inspectioncategoryitems: input.inspectioncategoryitems
+ )
+
+ }
+ }
+
+}
+extension InputTypeCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("inputtypes")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/i/InspectionCategoryCtrl.swift b/Sources/App/Controllers/i/InspectionCategoryCtrl.swift
new file mode 100644
index 0000000..70bab28
--- /dev/null
+++ b/Sources/App/Controllers/i/InspectionCategoryCtrl.swift
@@ -0,0 +1,170 @@
+//
+// InspectionCategoryCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/10/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class InspectionCategoryCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategory.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategory.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlInspectionCategory.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension InspectionCategoryCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlInspectionCategory.query(on: req.db).with(\.$inspection).with(\.$inspectioncategoryitems)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlInspectionCategory) -> mdlInspectionCategory.Output {
+ return mdlInspectionCategory.Output(
+ id: output.id!,
+ summary: output.summary,
+ sortorder: output.sortorder,
+ categoryname: output.categoryname,
+ categorydesription: output.categorydescription,
+ isactive: output.isactive,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ inspection: output.$inspection.value!,
+ inspectioncategoryitems: output.$inspectioncategoryitems.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlInspectionCategory.Input){
+ output.summary = input.summary;
+ output.sortorder = input.sortorder;
+ output.categoryname = input.categoryname;
+ output.categorydescription = input.categorydesription;
+ output.isactive = input.isactive;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$inspection.id = input.inspection.id!;
+ output.$inspectioncategoryitems.value = input.inspectioncategoryitems!
+ }
+
+ func createUnit(_ input: mdlInspectionCategory.Input) -> mdlInspectionCategory {
+ return mdlInspectionCategory(
+ id: input.id ?? nil
+ , summary: input.summary
+ , sortorder: input.sortorder
+ , categoryname: input.categoryname
+ , categorydescription: input.categorydesription
+ , isactive: input.isactive
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , inspection: input.inspection
+ , inspectioncategoyitems: input.inspectioncategoryitems
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlInspectionCategory.Output(
+ id: output.id!
+ , summary: output.summary
+ , sortorder: output.sortorder
+ , categoryname: output.categoryname
+ , categorydesription: output.categorydescription
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , inspection: output.inspection
+ , inspectioncategoryitems: output.inspectioncategoryitems
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlInspectionCategory, _ req: Request, _ input: mdlInspectionCategory.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlInspectionCategory.Output(
+ id: output.id!
+ , summary: output.summary
+ , sortorder: output.sortorder
+ , categoryname: output.categoryname
+ , categorydesription: output.categorydescription
+ , isactive: output.isactive
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , inspection: input.inspection
+ , inspectioncategoryitems: input.inspectioncategoryitems
+ )
+
+ }
+ }
+
+}
+extension InspectionCategoryCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("inspectioncategories")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/i/InspectionCategoryItemCtrl.swift b/Sources/App/Controllers/i/InspectionCategoryItemCtrl.swift
new file mode 100644
index 0000000..c5e140c
--- /dev/null
+++ b/Sources/App/Controllers/i/InspectionCategoryItemCtrl.swift
@@ -0,0 +1,217 @@
+//
+// InspectionCategoryItemCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/10/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+import AppKit
+
+final class InspectionCategoryItemCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategoryItem.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategoryItem.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlInspectionCategoryItem.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension InspectionCategoryItemCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlInspectionCategoryItem.query(on: req.db)
+ .with(\.$item)
+ .with(\.$inspectioncategory)
+ .with(\.$userdefinedcode)
+ .with(\.$inputtype)
+ .with(\.$currentitem)
+ .with(\.$parent)
+ .with(\.$inspectioncategoryitems)
+ .with(\.$inspectioncategoryitemresponsetypes)
+ .with(\.$inspectioncategoryitemspecs)
+ .with(\.$notes)
+ .with(\.$files)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlInspectionCategoryItem) -> mdlInspectionCategoryItem.Output {
+ return mdlInspectionCategoryItem.Output(
+ id: output.id!,
+ name: output.name,
+ description: output.description,
+ sortorder: output.sortorder,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ item: output.$item.value!,
+ inspectioncategory: output.$inspectioncategory.value!,
+ userdefinedcode: output.$userdefinedcode.value!,
+ inputtype: output.$inputtype.value!,
+ currentitem: output.$currentitem.value!,
+ parent: output.$parent.value!,
+ inspectioncategoryitems: output.$inspectioncategoryitems.value!,
+ inspectioncategoryitemresponsetypes: output.$inspectioncategoryitemresponsetypes.value!,
+ inspectioncategoryitemspecs: output.$inspectioncategoryitemspecs.value!,
+ notes: output.$notes.value!,
+ files: output.$files.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional.WrappedType, _ input: mdlInspectionCategoryItem.Input){
+ output.name = input.name;
+ output.description = input.description;
+ output.sortorder = input.sortorder;
+ output.createdate = input.createdate;
+ output.updatedate = input.updatedate;
+ output.createuserid = input.createuserid;
+ output.updateuserid = input.updateuserid;
+ output.$item.id = input.item.id!;
+ output.$inspectioncategory.id = input.inspectioncategory.id!;
+ output.$userdefinedcode.id = input.userdefinedcode.id!;
+ output.$inputtype.id = input.inputtype.id!;
+ output.$currentitem.id = input.currentitem.id!;
+ output.$parent.id = input.parent.id!;
+ output.$inspectioncategoryitems.value = input.inspectioncategoryitems;
+ output.$inspectioncategoryitemresponsetypes.value = input.inspectioncategoryitemresponsetypes;
+ output.$inspectioncategoryitemspecs.value = input.inspectioncategoryitemspecs;
+ output.$notes.value = input.notes;
+ output.$files.value = input.files;
+ }
+
+ func createUnit(_ input: mdlInspectionCategoryItem.Input) -> mdlInspectionCategoryItem {
+ return mdlInspectionCategoryItem(
+ id: input.id ?? nil
+ , name: input.name
+ , description: input.description
+ , sortorder: input.sortorder
+ , createuserid: input.createuserid ?? -1
+ , createdate: input.createdate
+ , updateuserid: input.updateuserid ?? -1
+ , updatedate: input.updatedate
+ , item: input.item
+ , inspectioncategory: input.inspectioncategory
+ , userdefinedcode: input.userdefinedcode
+ , inputtype: input.inputtype
+ , currentitem: input.currentitem
+ , parent: input.parent
+ , inspectioncategoryitems: input.inspectioncategoryitems
+ , inspectioncategoryitemresponsetypes: input.inspectioncategoryitemresponsetypes
+ , inspectioncategoryitemspecs: input.inspectioncategoryitemspecs
+ , notes: input.notes
+ , files: input.files
+ )
+ }
+
+ //update function
+ func save(_ output: Optional.WrappedType, req: Request) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{mdlInspectionCategoryItem.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortorder: output.sortorder
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , item: output.item
+ , inspectioncategory: output.inspectioncategory
+ , userdefinedcode: output.userdefinedcode
+ , inputtype: output.inputtype
+ , currentitem: output.currentitem
+ , parent: output.parent
+ , inspectioncategoryitems: output.inspectioncategoryitems
+ , inspectioncategoryitemresponsetypes: output.inspectioncategoryitemresponsetypes
+ , inspectioncategoryitemspecs: output.inspectioncategoryitemspecs
+ , notes: output.notes
+ , files: output.files
+ )
+ }
+ }
+ //create function
+ func save(_ output: mdlInspectionCategoryItem, _ req: Request, _ input: mdlInspectionCategoryItem.Input) -> EventLoopFuture {
+ return output
+ .save(on: req.db)
+ .map{
+ mdlInspectionCategoryItem.Output(
+ id: output.id!
+ , name: output.name
+ , description: output.description
+ , sortorder: output.sortorder
+ , createdate: output.createdate
+ , createuserid: output.createuserid
+ , updatedate: output.updatedate
+ , updateuserid: output.updateuserid
+ , item: input.item
+ , inspectioncategory: input.inspectioncategory
+ , userdefinedcode: input.userdefinedcode
+ , inputtype: input.inputtype
+ , currentitem: input.currentitem
+ , parent: input.parent
+ , inspectioncategoryitems: input.inspectioncategoryitems
+ , inspectioncategoryitemresponsetypes: input.inspectioncategoryitemresponsetypes
+ , inspectioncategoryitemspecs: input.inspectioncategoryitemspecs
+ , notes: input.notes
+ , files: input.files
+ )
+
+ }
+ }
+
+}
+extension InspectionCategoryItemCtrl: RouteCollection{
+ func boot(routes: RoutesBuilder) throws{
+ let apigroup = routes.grouped("inspectioncategoryitems")
+ apigroup.get("", use: readAll)
+ apigroup.get(":id", use: read)
+ apigroup.post("", use: create)
+ apigroup.post(":id", use: update)
+ apigroup.delete(":id", use: delete)
+
+
+ }
+}
diff --git a/Sources/App/Controllers/i/InspectionCategoryItemResponseTypeCtrl.swift b/Sources/App/Controllers/i/InspectionCategoryItemResponseTypeCtrl.swift
new file mode 100644
index 0000000..0484e3f
--- /dev/null
+++ b/Sources/App/Controllers/i/InspectionCategoryItemResponseTypeCtrl.swift
@@ -0,0 +1,160 @@
+//
+// InspectionCategoryItemResponseTypeCtrl.swift
+//
+//
+// Created by Michiel Carman on 11/10/21.
+//
+
+import Foundation
+import Vapor
+import Fluent
+import FluentPostgresDriver
+
+final class InspectionCategoryItemResponseTypeCtrl{
+ //Create Unit
+ func create(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategoryItemResponseType.Input.self)
+ let output = self.createUnit(input)
+ return self.save(output, req, input)
+
+ }
+
+ //Update Unit
+ func update(req: Request) throws -> EventLoopFuture{
+ let input = try req.content.decode(mdlInspectionCategoryItemResponseType.Input.self)
+ return try qbase(req: req).first().unwrap(or: Abort(.notFound)).flatMap{output in self.mapOutput(output, input)
+ return self.save(output, req: req)
+ }
+ }
+
+ //Get all Divisions
+ func readAll(req: Request) throws -> EventLoopFuture>{
+ return try qbase(req: req)
+ .paginate(for: req)
+ .map{
+ page in page.map{
+ self.createRead($0)
+ }
+ }
+ }
+ //Get 1 Division
+ func read(req: Request) throws -> EventLoopFuture{
+
+ return try qbase(req: req).first().unwrap(or: Abort(.internalServerError)).map{self.createRead($0)}
+
+ }
+ //Delete 1 Division
+ func delete(req: Request) throws -> EventLoopFuture{
+
+ guard let id = req.parameters.get("id", as: Int.self) else{
+ throw Abort(.badRequest)
+ }
+ return mdlInspectionCategoryItemResponseType.find(id, on: req.db).unwrap(or: Abort(.notFound)).flatMap{ $0.delete(on: req.db)}.map{.ok}
+ }
+
+}
+extension InspectionCategoryItemResponseTypeCtrl{
+ //Query Settings
+ func qbase(req: Request) throws -> QueryBuilder {
+ let query = mdlInspectionCategoryItemResponseType.query(on: req.db).with(\.$inspectioncategoryitem).with(\.$responsetype)
+ if let id = req.parameters.get("id", as: Int.self){
+ return query.filter(\.$id == id)
+ } else{
+ return query
+ }
+ }
+ //create Output
+ func createRead(_ output: mdlInspectionCategoryItemResponseType) -> mdlInspectionCategoryItemResponseType.Output {
+ return mdlInspectionCategoryItemResponseType.Output(
+ id: output.id!,
+ name: output.name,
+ sortorder: output.sortorder,
+ isselected: output.isselected,
+ createdate: output.createdate,
+ createuserid: output.createuserid,
+ updatedate: output.updatedate,
+ updateuserid: output.updateuserid,
+ inspectioncategoryitem: output.$inspectioncategoryitem.value!,
+ responsetype: output.$responsetype.value!
+ )
+ }
+
+ func mapOutput(_ output: Optional