| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 4.swift | |||
| // | |||
| // cntrlEquipmentType.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlEquipmentType: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("equipmenttypes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlEquipmentType] { | |||
| try await mdlEquipmentType.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlEquipmentType { | |||
| let obj = try req.content.decode(mdlEquipmentType.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlEquipmentType{ | |||
| let obj = try req.content.decode(mdlEquipmentType.self) | |||
| let dbobj = try await mdlEquipmentType.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlEquipmentType.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 5.swift | |||
| // | |||
| // cntrlFluid.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlFluid: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("fluids") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlFluid] { | |||
| try await mdlFluid.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlFluid { | |||
| let obj = try req.content.decode(mdlFluid.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlFluid{ | |||
| let obj = try req.content.decode(mdlFluid.self) | |||
| let dbobj = try await mdlFluid.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlFluid.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlIncompleteReason.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlIncompleteReason: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("incompletereasons") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlIncompleteReason] { | |||
| try await mdlIncompleteReason.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlIncompleteReason { | |||
| let obj = try req.content.decode(mdlIncompleteReason.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlIncompleteReason{ | |||
| let obj = try req.content.decode(mdlIncompleteReason.self) | |||
| let dbobj = try await mdlIncompleteReason.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlIncompleteReason.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File.swift | |||
| // | |||
| // cntrlInputType.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlInputType: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("inputtypes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlInputType] { | |||
| try await mdlInputType.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlInputType { | |||
| let obj = try req.content.decode(mdlInputType.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlInputType{ | |||
| let obj = try req.content.decode(mdlInputType.self) | |||
| let dbobj = try await mdlInputType.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlInputType.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlJobSite.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlJobSite: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("jobsites") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlJobSite] { | |||
| try await mdlJobSite.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlJobSite { | |||
| let obj = try req.content.decode(mdlJobSite.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlJobSite{ | |||
| let obj = try req.content.decode(mdlJobSite.self) | |||
| let dbobj = try await mdlJobSite.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlJobSite.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlLevel.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlLevel: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("levels") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlLevel] { | |||
| try await mdlLevel.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlLevel { | |||
| let obj = try req.content.decode(mdlLevel.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlLevel{ | |||
| let obj = try req.content.decode(mdlLevel.self) | |||
| let dbobj = try await mdlLevel.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlLevel.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlLocation.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlLocation: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("locations") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlLocation] { | |||
| try await mdlLocation.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlLocation { | |||
| let obj = try req.content.decode(mdlLocation.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlLocation{ | |||
| let obj = try req.content.decode(mdlLocation.self) | |||
| let dbobj = try await mdlLocation.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlLocation.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlNoteType.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlNoteType: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("notetypes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlNoteType] { | |||
| try await mdlNoteType.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlNoteType { | |||
| let obj = try req.content.decode(mdlNoteType.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlNoteType{ | |||
| let obj = try req.content.decode(mdlNoteType.self) | |||
| let dbobj = try await mdlNoteType.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlNoteType.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlPart.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlPart: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("parts") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlPart] { | |||
| try await mdlPart.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlPart { | |||
| let obj = try req.content.decode(mdlPart.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlPart{ | |||
| let obj = try req.content.decode(mdlPart.self) | |||
| let dbobj = try await mdlPart.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlPart.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlPriority.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlPriority: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("priorities") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlPriority] { | |||
| try await mdlPriority.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlPriority { | |||
| let obj = try req.content.decode(mdlPriority.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlPriority{ | |||
| let obj = try req.content.decode(mdlPriority.self) | |||
| let dbobj = try await mdlPriority.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlPriority.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlReason.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlReason: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("resons") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlReason] { | |||
| try await mdlReason.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlReason { | |||
| let obj = try req.content.decode(mdlReason.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlReason{ | |||
| let obj = try req.content.decode(mdlReason.self) | |||
| let dbobj = try await mdlReason.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlReason.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlRepairType.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlRepairType: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("repairtypes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlRepairType] { | |||
| try await mdlRepairType.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlRepairType { | |||
| let obj = try req.content.decode(mdlRepairType.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlRepairType{ | |||
| let obj = try req.content.decode(mdlRepairType.self) | |||
| let dbobj = try await mdlRepairType.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlRepairType.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlSMSCCode.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlSMSCCode: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("smsccodes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlSMSCCode] { | |||
| try await mdlSMSCCode.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlSMSCCode { | |||
| let obj = try req.content.decode(mdlSMSCCode.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlSMSCCode{ | |||
| let obj = try req.content.decode(mdlSMSCCode.self) | |||
| let dbobj = try await mdlSMSCCode.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlSMSCCode.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlSignatureType.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlSignatureType: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("signaturetypes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlSignatureType] { | |||
| try await mdlSignatureType.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlSignatureType { | |||
| let obj = try req.content.decode(mdlSignatureType.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlSignatureType{ | |||
| let obj = try req.content.decode(mdlSignatureType.self) | |||
| let dbobj = try await mdlSignatureType.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlSignatureType.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlState.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlState: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("states") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlState] { | |||
| try await mdlState.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlState { | |||
| let obj = try req.content.decode(mdlState.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlState{ | |||
| let obj = try req.content.decode(mdlState.self) | |||
| let dbobj = try await mdlState.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlState.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlStatus.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlStatus: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("statuses") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlStatus] { | |||
| try await mdlStatus.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlStatus { | |||
| let obj = try req.content.decode(mdlStatus.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlStatus{ | |||
| let obj = try req.content.decode(mdlStatus.self) | |||
| let dbobj = try await mdlStatus.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlStatus.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlViscosity.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlViscosity: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("viscosities") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlViscosity] { | |||
| try await mdlViscosity.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlViscosity { | |||
| let obj = try req.content.decode(mdlViscosity.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlViscosity{ | |||
| let obj = try req.content.decode(mdlViscosity.self) | |||
| let dbobj = try await mdlViscosity.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlViscosity.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlCompartment.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlCompartment: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("compartments") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlCompartment] { | |||
| try await mdlCompartment.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlCompartment { | |||
| let obj = try req.content.decode(mdlCompartment.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlCompartment{ | |||
| let obj = try req.content.decode(mdlCompartment.self) | |||
| let dbobj = try await mdlCompartment.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlCompartment.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File.swift | |||
| // | |||
| // cntrlCompartmentLocation.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlCompartmentLocation: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("comparmentlocations") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlCompartmentLocation] { | |||
| try await mdlCompartmentLocation.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlCompartmentLocation { | |||
| let obj = try req.content.decode(mdlCompartmentLocation.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlCompartmentLocation{ | |||
| let obj = try req.content.decode(mdlCompartmentLocation.self) | |||
| let dbobj = try await mdlCompartmentLocation.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlCompartmentLocation.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File.swift | |||
| // | |||
| // cntrlContact.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlContact: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("contacts") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlContact] { | |||
| try await mdlContact.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlContact { | |||
| let obj = try req.content.decode(mdlContact.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlContact{ | |||
| let obj = try req.content.decode(mdlContact.self) | |||
| let dbobj = try await mdlContact.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlContact.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 2.swift | |||
| // | |||
| // cntrlContactInfo.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlContactInfo: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("contactinfos") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlContactInfo] { | |||
| try await mdlContactInfo.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlContactInfo { | |||
| let obj = try req.content.decode(mdlContactInfo.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlContactInfo{ | |||
| let obj = try req.content.decode(mdlContactInfo.self) | |||
| let dbobj = try await mdlContactInfo.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlContactInfo.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 3.swift | |||
| // | |||
| // cntrlCustomer.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlCustomer: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("customers") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlCustomer] { | |||
| try await mdlCustomer.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlCustomer { | |||
| let obj = try req.content.decode(mdlCustomer.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlCustomer{ | |||
| let obj = try req.content.decode(mdlCustomer.self) | |||
| let dbobj = try await mdlCustomer.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlCustomer.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 4.swift | |||
| // | |||
| // cntrlEquipment.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlEquipment: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("equipments") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlEquipment] { | |||
| try await mdlEquipment.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlEquipment { | |||
| let obj = try req.content.decode(mdlEquipment.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlEquipment{ | |||
| let obj = try req.content.decode(mdlEquipment.self) | |||
| let dbobj = try await mdlEquipment.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlEquipment.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 5.swift | |||
| // | |||
| // cntrlMake.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlMake: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("makes") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlMake] { | |||
| try await mdlMake.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlMake { | |||
| let obj = try req.content.decode(mdlMake.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlMake{ | |||
| let obj = try req.content.decode(mdlMake.self) | |||
| let dbobj = try await mdlMake.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlMake.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 6.swift | |||
| // | |||
| // cntrlModel.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlModel: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("models") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlModel] { | |||
| try await mdlModel.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlModel { | |||
| let obj = try req.content.decode(mdlModel.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlModel{ | |||
| let obj = try req.content.decode(mdlModel.self) | |||
| let dbobj = try await mdlModel.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlModel.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File 7.swift | |||
| // | |||
| // cntrlObjectProperty.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlObjProperty: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("objproperies") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlObjProperty] { | |||
| try await mdlObjProperty.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlObjProperty { | |||
| let obj = try req.content.decode(mdlObjProperty.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlObjProperty{ | |||
| let obj = try req.content.decode(mdlObjProperty.self) | |||
| let dbobj = try await mdlObjProperty.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlObjProperty.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -1,8 +1,49 @@ | |||
| // | |||
| // File.swift | |||
| // | |||
| // cntrlProduct.swift | |||
| // | |||
| // Created by Michiel Carman on 4/2/24. | |||
| // | |||
| // Created by Michiel Carman on 4/1/24. | |||
| // | |||
| import Fluent | |||
| import Vapor | |||
| import Foundation | |||
| struct cntrlProduct: RouteCollection { | |||
| func boot(routes: RoutesBuilder) throws { | |||
| let rts = routes.grouped("products") | |||
| rts.get(use: index) | |||
| rts.post(use: create) | |||
| rts.put(use: update) | |||
| rts.group(":id") { rt in | |||
| rts.delete(use: delete) | |||
| } | |||
| } | |||
| func index(req: Request) async throws -> [mdlProduct] { | |||
| try await mdlProduct.query(on: req.db).all() | |||
| } | |||
| func create(req: Request) async throws -> mdlProduct { | |||
| let obj = try req.content.decode(mdlProduct.self) | |||
| try await obj.save(on: req.db) | |||
| return obj | |||
| } | |||
| func update(req: Request) async throws -> mdlProduct{ | |||
| let obj = try req.content.decode(mdlProduct.self) | |||
| let dbobj = try await mdlProduct.query(on: req.db).filter(\.$id == obj.id!).first()! | |||
| dbobj.updatedate = Date() | |||
| dbobj.updateuserid = -1 | |||
| try await dbobj.update(on: req.db) | |||
| return dbobj | |||
| } | |||
| func delete(req: Request) async throws -> HTTPStatus { | |||
| guard let obj = try await mdlProduct.find(req.parameters.get("id"), on: req.db) else { | |||
| throw Abort(.notFound) | |||
| } | |||
| try await obj.delete(on: req.db) | |||
| return .noContent | |||
| } | |||
| } | |||
| @@ -15,9 +15,9 @@ enum CryptoError: Error{ | |||
| struct CustomCrypto{ | |||
| public static func DecryptString(input: String) throws -> String{ | |||
| let apikey = Environment.get("API_KEY") | |||
| let apikey = Environment.get("API_KEY") ?? "rv0ywT7Ygwh01jP1dQWBP39ogjq5ladO+EoNUGcBVq0=" | |||
| print(apikey) | |||
| let base64Key = "rv0ywT7Ygwh01jP1dQWBP39ogjq5ladO+EoNUGcBVq0=" // Replace with your actual key | |||
| let base64Key = apikey // Replace with your actual key | |||
| guard let keyData = Data(base64Encoded: base64Key) else { | |||
| fatalError("Invalid Base64 key data") | |||
| } | |||
| @@ -27,6 +27,36 @@ func routes(_ app: Application) throws { | |||
| try baseApp.register(collection: cntrlSegment()) | |||
| try baseApp.register(collection: cntrlResponseType()) | |||
| try baseApp.register(collection: cntrlUnit()) | |||
| try baseApp.register(collection: cntrlComparisonType()) | |||
| try baseApp.register(collection: cntrlEquipmentType()) | |||
| try baseApp.register(collection: cntrlFluid()) | |||
| try baseApp.register(collection: cntrlFuel()) | |||
| try baseApp.register(collection: cntrlIncompleteReason()) | |||
| try baseApp.register(collection: cntrlInputType()) | |||
| try baseApp.register(collection: cntrlJobSite()) | |||
| try baseApp.register(collection: cntrlLevel()) | |||
| try baseApp.register(collection: cntrlLocation()) | |||
| try baseApp.register(collection: cntrlNoteType()) | |||
| try baseApp.register(collection: cntrlPart()) | |||
| try baseApp.register(collection: cntrlPriority()) | |||
| try baseApp.register(collection: cntrlReason()) | |||
| try baseApp.register(collection: cntrlRepairType()) | |||
| try baseApp.register(collection: cntrlSignatureType()) | |||
| try baseApp.register(collection: cntrlState()) | |||
| try baseApp.register(collection: cntrlStatus()) | |||
| try baseApp.register(collection: cntrlValueType()) | |||
| try baseApp.register(collection: cntrlViscosity()) | |||
| try baseApp.register(collection: cntrlCompartment()) | |||
| try baseApp.register(collection: cntrlCompartmentLocation()) | |||
| try baseApp.register(collection: cntrlContact()) | |||
| try baseApp.register(collection: cntrlContactInfo()) | |||
| try baseApp.register(collection: cntrlCustomer()) | |||
| try baseApp.register(collection: cntrlEquipment()) | |||
| try baseApp.register(collection: cntrlMake()) | |||
| try baseApp.register(collection: cntrlModel()) | |||
| try baseApp.register(collection: cntrlObjProperty()) | |||
| try baseApp.register(collection: cntrlProduct()) | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| API_KEY="rv0ywT7Ygwh01jP1dQWBP39ogjq5ladO+EoNUGcBVq0=" | |||