| @@ -1,4 +1,4 @@ | |||||
| // swift-tools-version:5.9 | |||||
| // swift-tools-version:5.10 | |||||
| import PackageDescription | import PackageDescription | ||||
| let package = Package( | let package = Package( | ||||
| @@ -48,5 +48,26 @@ struct CustomCrypto{ | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| struct Base64{ | |||||
| public static func Base64Encode(input: String) throws -> String{ | |||||
| guard let dataToEncode = input.data(using: .utf8) else{ fatalError("Invalid Data")} | |||||
| let base64EncodedString = dataToEncode.base64EncodedString() | |||||
| let urlEncodedString = base64EncodedString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) | |||||
| return urlEncodedString! | |||||
| } | |||||
| public static func Base64Decode(input: String) throws -> [String: String]{ | |||||
| var dic: [String: String] = [:] | |||||
| guard let base64EncodedData = input.data(using: .utf8) else { fatalError("Invalid Data")} | |||||
| if let data = Data(base64Encoded: base64EncodedData){ | |||||
| let str = String(data: data, encoding: .utf8) | |||||
| let strArr = str!.components(separatedBy: ";") | |||||
| for s in strArr{ | |||||
| let pcs = s.components(separatedBy: "=") | |||||
| dic[pcs[0]] = pcs[1] | |||||
| } | |||||
| } | |||||
| return dic | |||||
| } | |||||
| } | |||||
| @@ -93,6 +93,19 @@ extension mdlUser{ | |||||
| try await database.schema("user").delete() | try await database.schema("user").delete() | ||||
| } | } | ||||
| } | } | ||||
| struct Customer: AsyncMigration { | |||||
| func prepare(on database: Database) async throws { | |||||
| try await database.schema("user") | |||||
| .field("customerId", .int, .references("customer", "id")) | |||||
| .update() | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await database.schema("user") | |||||
| .deleteField("customerId") | |||||
| .update() | |||||
| } | |||||
| } | |||||
| struct ReSeed: AsyncMigration{ | struct ReSeed: AsyncMigration{ | ||||
| func prepare(on database: Database) async throws { | func prepare(on database: Database) async throws { | ||||
| if let db = database as? SQLDatabase{ | if let db = database as? SQLDatabase{ | ||||
| @@ -21,6 +21,7 @@ final class mdlCategory: Model, Content { | |||||
| @Children(for: \.$category) var categories: [mdlInspectionCategory] | @Children(for: \.$category) var categories: [mdlInspectionCategory] | ||||
| @Children(for: \.$category) var templatecategories: [mdlTemplateCategory] | @Children(for: \.$category) var templatecategories: [mdlTemplateCategory] | ||||
| @Children(for: \.$category) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -63,6 +64,7 @@ extension mdlCategory{ | |||||
| let query = mdlCategory.query(on: req.db) | let query = mdlCategory.query(on: req.db) | ||||
| .with(\.$categories) | .with(\.$categories) | ||||
| .with(\.$templatecategories) | .with(\.$templatecategories) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -22,6 +22,7 @@ final class mdlComparisonType: Model, Content { | |||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @Field(key: "updateUserId") var updateuserid: Int? | @Field(key: "updateUserId") var updateuserid: Int? | ||||
| @Children(for: \.$comparisontype) var values: [mdlTblValue] | |||||
| init() { } | init() { } | ||||
| @@ -78,6 +79,7 @@ extension mdlComparisonType{ | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlComparisonType>{ | public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlComparisonType>{ | ||||
| let query = mdlComparisonType.query(on: req.db) | let query = mdlComparisonType.query(on: req.db) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -20,6 +20,7 @@ final class mdlContactType: Model, Content { | |||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$contacttype) var info: [mdlContactInfo] | @Children(for: \.$contacttype) var info: [mdlContactInfo] | ||||
| @Children(for: \.$contacttype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -80,6 +81,8 @@ extension mdlContactType{ | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlContactType>{ | public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlContactType>{ | ||||
| let query = mdlContactType.query(on: req.db) | let query = mdlContactType.query(on: req.db) | ||||
| .with(\.$info) | |||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -19,6 +19,7 @@ final class mdlDataType: Model, Content { | |||||
| @Field(key: "description") var description: String? | @Field(key: "description") var description: String? | ||||
| @Children(for: \.$datatype) var units: [mdlUnit] | @Children(for: \.$datatype) var units: [mdlUnit] | ||||
| @Children(for: \.$datatype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -80,6 +81,7 @@ extension mdlDataType{ | |||||
| let query = mdlDataType.query(on: req.db) | let query = mdlDataType.query(on: req.db) | ||||
| .with(\.$units) | .with(\.$units) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -20,7 +20,7 @@ final class mdlDivision: Model, Content { | |||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$division) var users: [mdlUser] | @Children(for: \.$division) var users: [mdlUser] | ||||
| @Children(for: \.$division) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -64,6 +64,7 @@ extension mdlDivision{ | |||||
| let query = mdlDivision.query(on: req.db) | let query = mdlDivision.query(on: req.db) | ||||
| .with(\.$users) | .with(\.$users) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -19,6 +19,8 @@ final class mdlEquipmentType: Model, Content { | |||||
| @Field(key: "description") var description: String? | @Field(key: "description") var description: String? | ||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$equipmenttype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @@ -74,6 +76,7 @@ extension mdlEquipmentType{ | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlEquipmentType>{ | public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlEquipmentType>{ | ||||
| let query = mdlEquipmentType.query(on: req.db) | let query = mdlEquipmentType.query(on: req.db) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -21,6 +21,7 @@ final class mdlFuel: Model, Content { | |||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$fuel) var workorders: [mdlWorkOrder] | @Children(for: \.$fuel) var workorders: [mdlWorkOrder] | ||||
| @Children(for: \.$fuel) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -66,6 +67,7 @@ extension mdlFuel{ | |||||
| let query = mdlFuel.query(on: req.db) | let query = mdlFuel.query(on: req.db) | ||||
| .with(\.$workorders) | .with(\.$workorders) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -23,6 +23,7 @@ | |||||
| @Parent(key: "locationId") var location: mdlLocation | @Parent(key: "locationId") var location: mdlLocation | ||||
| @Children(for: \.$gate) var users: [mdlUser] | @Children(for: \.$gate) var users: [mdlUser] | ||||
| @Children(for: \.$gate) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -83,6 +84,7 @@ | |||||
| let query = mdlGate.query(on: req.db) | let query = mdlGate.query(on: req.db) | ||||
| .with(\.$users) | .with(\.$users) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -20,6 +20,7 @@ final class mdlIncompleteReason: Model, Content { | |||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$incompletereason) var workorders: [mdlWorkOrder] | @Children(for: \.$incompletereason) var workorders: [mdlWorkOrder] | ||||
| @Children(for: \.$incompletereason) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -63,6 +64,7 @@ extension mdlIncompleteReason{ | |||||
| let query = mdlIncompleteReason.query(on: req.db) | let query = mdlIncompleteReason.query(on: req.db) | ||||
| .with(\.$workorders) | .with(\.$workorders) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -19,6 +19,7 @@ final class mdlInputType: Model, Content { | |||||
| @Field(key: "description") var description: String? | @Field(key: "description") var description: String? | ||||
| @Children(for: \.$inputtype) var inspectionitems: [mdlInspectionItem] | @Children(for: \.$inputtype) var inspectionitems: [mdlInspectionItem] | ||||
| @Children(for: \.$inputtype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -79,6 +80,7 @@ extension mdlInputType{ | |||||
| let query = mdlInputType.query(on: req.db) | let query = mdlInputType.query(on: req.db) | ||||
| .with(\.$inspectionitems) | .with(\.$inspectionitems) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -18,7 +18,7 @@ final class mdlSysCategory: Model, Content { | |||||
| @Field(key: "name") var name: String? | @Field(key: "name") var name: String? | ||||
| @Field(key: "description") var description: String? | @Field(key: "description") var description: String? | ||||
| @Children(for: \.$syscat) var uoms: [mdlSysUOM] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @@ -65,27 +65,27 @@ extension mdlSysCategory{ | |||||
| description: "Unit of distance.", | description: "Unit of distance.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| updateuserid: -1), | updateuserid: -1), | ||||
| .init(id: 1, | |||||
| .init(id: 2, | |||||
| name: "WEIGHT", | name: "WEIGHT", | ||||
| description: "Unit of force.", | description: "Unit of force.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| updateuserid: -1), | updateuserid: -1), | ||||
| .init(id: 1, | |||||
| .init(id: 3, | |||||
| name: "CAPACITY", | name: "CAPACITY", | ||||
| description: "Unit of capacity.", | description: "Unit of capacity.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| updateuserid: -1), | updateuserid: -1), | ||||
| .init(id: 1, | |||||
| .init(id: 4, | |||||
| name: "VOLUME", | name: "VOLUME", | ||||
| description: "Unit of volume.", | description: "Unit of volume.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| updateuserid: -1), | updateuserid: -1), | ||||
| .init(id: 1, | |||||
| .init(id: 5, | |||||
| name: "AREA", | name: "AREA", | ||||
| description: "Unit of area.", | description: "Unit of area.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| updateuserid: -1), | updateuserid: -1), | ||||
| .init(id: 1, | |||||
| .init(id: 6, | |||||
| name: "TEMPERATURE", | name: "TEMPERATURE", | ||||
| description: "Unit of temperature.", | description: "Unit of temperature.", | ||||
| createuserid: -1, | createuserid: -1, | ||||
| @@ -1,8 +1,92 @@ | |||||
| // | // | ||||
| // File.swift | |||||
| // | |||||
| // mdlSysOfMeasure.swift | |||||
| // | // | ||||
| // Created by Michiel Carman on 5/6/24. | |||||
| // | // | ||||
| // Created by Michiel Carman on 2/16/24. | |||||
| // | |||||
| import Fluent | |||||
| import Vapor | |||||
| import Foundation | import Foundation | ||||
| import FluentKit | |||||
| final class mdlSysOfMeasure: Model, Content { | |||||
| static let schema = "sysOfMeasure" | |||||
| @ID(custom: "id", generatedBy: .database) var id: Int? | |||||
| @Field(key: "name") var name: String? | |||||
| @Field(key: "description") var description: String? | |||||
| @Children(for: \.$sys) var uoms: [mdlSysUOM] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | |||||
| @Field(key: "createUserId") var createuserid: Int? | |||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | |||||
| @Field(key: "updateUserId") var updateuserid: Int? | |||||
| init() { } | |||||
| init(id: Int? = nil, | |||||
| name: String? = nil, | |||||
| description: String? = nil, | |||||
| createuserid: Int? = nil, | |||||
| updateuserid: Int? = nil | |||||
| ) { | |||||
| self.id = id | |||||
| self.name = name | |||||
| self.description = description | |||||
| self.createuserid = createuserid | |||||
| self.updateuserid = updateuserid | |||||
| } | |||||
| } | |||||
| extension mdlSysOfMeasure{ | |||||
| struct Create: AsyncMigration { | |||||
| func prepare(on database: Database) async throws { | |||||
| try await database.schema("sysOfMeasure") | |||||
| .field("id", .int, .identifier(auto: true)) | |||||
| .field("name", .string) | |||||
| .field("description", .string) | |||||
| .field("createDate", .datetime) | |||||
| .field("createUserId", .int) | |||||
| .field("updateDate", .datetime) | |||||
| .field("updateUserId", .int) | |||||
| .create() | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await database.schema("sysOfMeasure").delete() | |||||
| } | |||||
| } | |||||
| struct Seed: AsyncMigration{ | |||||
| func prepare(on database: FluentKit.Database) async throws { | |||||
| let mdls: [mdlSysOfMeasure] = [ | |||||
| .init(id: 1, | |||||
| name: "METRIC", | |||||
| description: "International System of Units", | |||||
| createuserid: -1, | |||||
| updateuserid: -1), | |||||
| .init(id: 2, | |||||
| name: "IMPERIAL", | |||||
| description: "British Imperial System", | |||||
| createuserid: -1, | |||||
| updateuserid: -1), | |||||
| .init(id: 3, | |||||
| name: "US", | |||||
| description: "US Customary System", | |||||
| createuserid: -1, | |||||
| updateuserid: -1) | |||||
| ] | |||||
| for mdl in mdls{ | |||||
| try await mdl.save(on: database) | |||||
| } | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await mdlSysOfMeasure.query(on: database).delete() | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,8 +1,137 @@ | |||||
| // | // | ||||
| // File.swift | |||||
| // | |||||
| // mdlSysUOM.swift | |||||
| // | // | ||||
| // Created by Michiel Carman on 5/6/24. | |||||
| // | // | ||||
| // Created by Michiel Carman on 2/16/24. | |||||
| // | |||||
| import Fluent | |||||
| import Vapor | |||||
| import Foundation | import Foundation | ||||
| import FluentKit | |||||
| final class mdlSysUOM: Model, Content { | |||||
| static let schema = "sysUOM" | |||||
| @ID(custom: "id", generatedBy: .database) var id: Int? | |||||
| @Field(key: "name") var name: String? | |||||
| @Field(key: "description") var description: String? | |||||
| @Parent(key: "sysOfMeasureId") var sys: mdlSysOfMeasure | |||||
| @Parent(key: "sysCategoryId") var syscat: mdlSysCategory | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | |||||
| @Field(key: "createUserId") var createuserid: Int? | |||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | |||||
| @Field(key: "updateUserId") var updateuserid: Int? | |||||
| init() { } | |||||
| init(id: Int? = nil, | |||||
| name: String? = nil, | |||||
| description: String? = nil, | |||||
| sysid: Int, | |||||
| syscatid: Int, | |||||
| createuserid: Int? = nil, | |||||
| updateuserid: Int? = nil | |||||
| ) { | |||||
| self.id = id | |||||
| self.name = name | |||||
| self.description = description | |||||
| self.$sys.$id.value = sysid | |||||
| self.$syscat.$id.value = syscatid | |||||
| self.createuserid = createuserid | |||||
| self.updateuserid = updateuserid | |||||
| } | |||||
| } | |||||
| extension mdlSysUOM{ | |||||
| struct Create: AsyncMigration { | |||||
| func prepare(on database: Database) async throws { | |||||
| try await database.schema("sysUOM") | |||||
| .field("id", .int, .identifier(auto: true)) | |||||
| .field("name", .string) | |||||
| .field("description", .string) | |||||
| .field("sysOfMeasureId", .int, .references("sysOfMeasure", "id")) | |||||
| .field("sysCategoryId", .int, .references("sysCategory", "id")) | |||||
| .field("createDate", .datetime) | |||||
| .field("createUserId", .int) | |||||
| .field("updateDate", .datetime) | |||||
| .field("updateUserId", .int) | |||||
| .create() | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await database.schema("sysUOM").delete() | |||||
| } | |||||
| } | |||||
| struct Seed: AsyncMigration{ | |||||
| func prepare(on database: FluentKit.Database) async throws { | |||||
| let sys = try await mdlSysOfMeasure.query(on: database).all() | |||||
| let u = try await mdlSysCategory.query(on: database).all() | |||||
| var mdls: [mdlSysUOM] = [] | |||||
| for s in sys{ | |||||
| _ = s.id! | |||||
| for c in u{ | |||||
| _ = c.id! | |||||
| if(c.name == "LENGTH"){ | |||||
| if(s.id == 1){ | |||||
| mdls.append( | |||||
| .init(id: nil, name: "M", description: "Meter", sysid: s.id!, syscatid: c.id!, createuserid: -1, updateuserid: -1 | |||||
| ) | |||||
| ) | |||||
| mdls.append( | |||||
| .init(id: nil, name: "cm", description: "centiMeter", sysid: s.id!, syscatid: c.id!, createuserid: -1, updateuserid: -1 | |||||
| ) | |||||
| ) | |||||
| mdls.append( | |||||
| .init(id: nil, name: "mm", description: "Milimeter", sysid: s.id!, syscatid: c.id!, createuserid: -1, updateuserid: -1 | |||||
| ) | |||||
| ) | |||||
| mdls.append( | |||||
| .init(id: nil, name: "nm", description: "Nanometer", sysid: s.id!, syscatid: c.id!, createuserid: -1, updateuserid: -1 | |||||
| ) | |||||
| ) | |||||
| mdls.append( | |||||
| .init(id: nil, name: "KM", description: "Kilometer", sysid: s.id!, syscatid: c.id!, createuserid: -1, updateuserid: -1 | |||||
| ) | |||||
| ) | |||||
| } | |||||
| } | |||||
| if(c.name == "WEIGHT"){ | |||||
| } | |||||
| if(c.name == "CAPACITY"){ | |||||
| } | |||||
| if(c.name == "VOLUME"){ | |||||
| } | |||||
| if(c.name == "AREA"){ | |||||
| } | |||||
| if(c.name == "TEMPERATURE"){ | |||||
| } | |||||
| } | |||||
| } | |||||
| // let mdls: [mdlSysUOM] = [ | |||||
| // .init(id: 1, | |||||
| // name: "Built motor", | |||||
| // description: "d", | |||||
| // createuserid: -1, | |||||
| // updateuserid: -1) | |||||
| // ] | |||||
| for mdl in mdls{ | |||||
| try await mdl.save(on: database) | |||||
| } | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await mdlSysUOM.query(on: database).delete() | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -20,6 +20,7 @@ final class mdlCompartment: Model, Content { | |||||
| @Field(key: "code") var code: String? | @Field(key: "code") var code: String? | ||||
| @Field(key: "sortOrder") var sortorder: Int? | @Field(key: "sortOrder") var sortorder: Int? | ||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$compartment) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -65,7 +66,7 @@ extension mdlCompartment{ | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlCompartment>{ | public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlCompartment>{ | ||||
| let query = mdlCompartment.query(on: req.db) | let query = mdlCompartment.query(on: req.db) | ||||
| // .with(\.$<#parent/children#>) | |||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -25,6 +25,8 @@ final class mdlCompartmentLocation: Model, Content { | |||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @Field(key: "updateUserId") var updateuserid: Int? | @Field(key: "updateUserId") var updateuserid: Int? | ||||
| @Children(for: \.$compartmentlocation) var values: [mdlTblValue] | |||||
| init() { } | init() { } | ||||
| init(id: Int? = nil, name: String? = nil, description: String? = nil, code: String? = nil, sortorder: Int?, isactive: Bool?, createuserid: Int? = nil, updateuserid: Int? = nil) { | init(id: Int? = nil, name: String? = nil, description: String? = nil, code: String? = nil, sortorder: Int?, isactive: Bool?, createuserid: Int? = nil, updateuserid: Int? = nil) { | ||||
| @@ -64,7 +66,7 @@ extension mdlCompartmentLocation{ | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlCompartmentLocation>{ | public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlCompartmentLocation>{ | ||||
| let query = mdlCompartmentLocation.query(on: req.db) | let query = mdlCompartmentLocation.query(on: req.db) | ||||
| // .with(\.$<#parent/children#>) | |||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -24,6 +24,7 @@ final class mdlItem: Model, Content { | |||||
| @Parent(key: "inputTypeId") var inputtype: mdlInputType | @Parent(key: "inputTypeId") var inputtype: mdlInputType | ||||
| @Children(for: \.$item) var templateitems: [mdlTemplateItemSpec] | @Children(for: \.$item) var templateitems: [mdlTemplateItemSpec] | ||||
| @Children(for: \.$item) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -87,6 +88,7 @@ extension mdlItem{ | |||||
| let query = mdlItem.query(on: req.db) | let query = mdlItem.query(on: req.db) | ||||
| .with(\.$templateitems) | .with(\.$templateitems) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -20,6 +20,8 @@ final class mdlItemResponseType: Model, Content { | |||||
| @Field(key: "sortOrder") var sortrder: Int? | @Field(key: "sortOrder") var sortrder: Int? | ||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$itemresponsetype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @@ -77,6 +79,7 @@ extension mdlItemResponseType{ | |||||
| let query = mdlItemResponseType.query(on: req.db) | let query = mdlItemResponseType.query(on: req.db) | ||||
| .with(\.$item) | .with(\.$item) | ||||
| .with(\.$responsetype) | .with(\.$responsetype) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -28,6 +28,7 @@ final class mdlInspectionItem: Model, Content { | |||||
| @Children(for: \.$inspectionitem) var responses: [mdlInspectionItemResponse] | @Children(for: \.$inspectionitem) var responses: [mdlInspectionItemResponse] | ||||
| @Children(for: \.$inspectionitem) var specs: [mdlInspectionItemSpec] | @Children(for: \.$inspectionitem) var specs: [mdlInspectionItemSpec] | ||||
| @Children(for: \.$item) var notes: [mdlNote] | @Children(for: \.$item) var notes: [mdlNote] | ||||
| @Children(for: \.$inspectionitem) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -120,6 +121,7 @@ extension mdlInspectionItem{ | |||||
| .with(\.$responses) | .with(\.$responses) | ||||
| .with(\.$specs) | .with(\.$specs) | ||||
| .with(\.$notes) | .with(\.$notes) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -28,6 +28,8 @@ final class mdlInspectionItemResponse: Model, Content { | |||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | ||||
| @Field(key: "updateUserId") var updateuserid: Int? | @Field(key: "updateUserId") var updateuserid: Int? | ||||
| @Children(for: \.$inspectionitemresponse) var values: [mdlTblValue] | |||||
| init() { } | init() { } | ||||
| init(id: Int? = nil, | init(id: Int? = nil, | ||||
| @@ -75,6 +77,7 @@ extension mdlInspectionItemResponse{ | |||||
| let query = mdlInspectionItemResponse.query(on: req.db) | let query = mdlInspectionItemResponse.query(on: req.db) | ||||
| .with(\.$inspectionitem) | .with(\.$inspectionitem) | ||||
| .with(\.$responsetype) | .with(\.$responsetype) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -22,6 +22,7 @@ final class mdlInspectionLevel: Model, Content { | |||||
| @Parent(key: "inspectionTypeId") var inspectiontype: mdlInspectionType | @Parent(key: "inspectionTypeId") var inspectiontype: mdlInspectionType | ||||
| @Children(for: \.$level) var inspections: [mdlInspection] | @Children(for: \.$level) var inspections: [mdlInspection] | ||||
| @Children(for: \.$level) var templates: [mdlTemplate] | @Children(for: \.$level) var templates: [mdlTemplate] | ||||
| @Children(for: \.$inspectionlevel) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -73,6 +74,7 @@ extension mdlInspectionLevel{ | |||||
| .with(\.$inspectiontype) | .with(\.$inspectiontype) | ||||
| .with(\.$inspections) | .with(\.$inspections) | ||||
| .with(\.$templates) | .with(\.$templates) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -21,6 +21,7 @@ final class mdlInspectionType: Model, Content { | |||||
| @Field(key: "isActive") var isactive: Bool? | @Field(key: "isActive") var isactive: Bool? | ||||
| @Children(for: \.$inspectiontype) var inspectionlevels: [mdlInspectionLevel] | @Children(for: \.$inspectiontype) var inspectionlevels: [mdlInspectionLevel] | ||||
| @Children(for: \.$inspectiontype) var values: [mdlTblValue] | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | @Timestamp(key: "createDate", on: .create) var createdate: Date? | ||||
| @Field(key: "createUserId") var createuserid: Int? | @Field(key: "createUserId") var createuserid: Int? | ||||
| @@ -69,6 +70,7 @@ extension mdlInspectionType{ | |||||
| let query = mdlInspectionType.query(on: req.db) | let query = mdlInspectionType.query(on: req.db) | ||||
| .with(\.$inspectionlevels) | .with(\.$inspectionlevels) | ||||
| .with(\.$values) | |||||
| if let x = req.parameters.get("x"){ | if let x = req.parameters.get("x"){ | ||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | let decryptedString = try CustomCrypto.DecryptString(input: x) | ||||
| @@ -1,8 +1,218 @@ | |||||
| // | // | ||||
| // File.swift | |||||
| // | |||||
| // mdlTblValue.swift | |||||
| // | // | ||||
| // Created by Michiel Carman on 5/14/24. | |||||
| // | // | ||||
| // Created by Michiel Carman on 2/16/24. | |||||
| // | |||||
| import Fluent | |||||
| import Vapor | |||||
| import Foundation | import Foundation | ||||
| import FluentKit | |||||
| final class mdlTblValue: Model, Content { | |||||
| static let schema = "tblValue" | |||||
| @ID(custom: "id", generatedBy: .database) var id: Int? | |||||
| @Field(key: "field") var field: String? | |||||
| @Field(key: "value") var value: String? | |||||
| @Timestamp(key: "createDate", on: .create) var createdate: Date? | |||||
| @Field(key: "createUserId") var createuserid: Int? | |||||
| @Timestamp(key: "updateDate", on: .update) var updatedate: Date? | |||||
| @Field(key: "updateUserId") var updateuserid: Int? | |||||
| @Parent(key: "localeId") var locale: mdlLocale | |||||
| @OptionalParent(key: "categoryId") var category: mdlCategory? | |||||
| @OptionalParent(key: "comparisonTypeId") var comparisontype: mdlComparisonType? | |||||
| @OptionalParent(key: "compartmentId") var compartment: mdlCompartment? | |||||
| @OptionalParent(key: "compartmentLocationId") var compartmentlocation: mdlCompartmentLocation? | |||||
| @OptionalParent(key: "contactTypeId") var contacttype: mdlContactType? | |||||
| @OptionalParent(key: "dataTypeId") var datatype: mdlDataType? | |||||
| @OptionalParent(key: "divisiontId") var division: mdlDivision? | |||||
| @OptionalParent(key: "equipmentTypeId") var equipmenttype: mdlEquipmentType? | |||||
| @OptionalParent(key: "fluidId") var fluid: mdlFluid? | |||||
| @OptionalParent(key: "fuelId") var fuel: mdlFuel? | |||||
| @OptionalParent(key: "gateId") var gate: mdlGate? | |||||
| @OptionalParent(key: "incompleteReasonId") var incompletereason: mdlIncompleteReason? | |||||
| @OptionalParent(key: "inputTypeId") var inputtype: mdlInputType? | |||||
| @OptionalParent(key: "inspectionItemId") var inspectionitem: mdlInspectionItem? | |||||
| @OptionalParent(key: "inspectionItemResponseId") var inspectionitemresponse: mdlInspectionItemResponse? | |||||
| @OptionalParent(key: "inspectionLevelId") var inspectionlevel: mdlInspectionLevel? | |||||
| @OptionalParent(key: "inspectionTypeId") var inspectiontype: mdlInspectionType? | |||||
| @OptionalParent(key: "itemId") var item: mdlItem? | |||||
| @OptionalParent(key: "itemResponseTypeId") var itemresponsetype: mdlItemResponseType? | |||||
| init() { } | |||||
| init(id: Int? = nil, | |||||
| field: String? = nil, | |||||
| value: String? = nil, | |||||
| localid: Int, | |||||
| categoryid: Int? = nil, | |||||
| comparisontypeid: Int? = nil, | |||||
| compartmentid: Int? = nil, | |||||
| compartmentlocationid: Int? = nil, | |||||
| contacttypeid: Int? = nil, | |||||
| datatypeid: Int? = nil, | |||||
| divisionid: Int? = nil, | |||||
| equipmenttypeid: Int? = nil, | |||||
| fluidid: Int? = nil, | |||||
| gateid: Int? = nil, | |||||
| fuelid: Int? = nil, | |||||
| incompletereasonid: Int? = nil, | |||||
| inputtypeid: Int? = nil, | |||||
| inspectionitemid: Int? = nil, | |||||
| inspectionitemresponseid: Int? = nil, | |||||
| inspectionlevelid: Int? = nil, | |||||
| inspectiontypeid: Int? = nil, | |||||
| itemid: Int? = nil, | |||||
| itemresponsetypeid: Int? = nil, | |||||
| createuserid: Int? = nil, | |||||
| updateuserid: Int? = nil | |||||
| ) { | |||||
| self.id = id | |||||
| self.field = field | |||||
| self.value = value | |||||
| self.$locale.$id.value = localid | |||||
| self.$category.$id.value = categoryid! | |||||
| self.$comparisontype.$id.value = comparisontypeid! | |||||
| self.$compartment.$id.value = compartmentid! | |||||
| self.$compartmentlocation.$id.value = compartmentlocationid! | |||||
| self.$contacttype.$id.value = contacttypeid! | |||||
| self.$datatype.$id.value = datatypeid! | |||||
| self.$division.$id.value = divisionid! | |||||
| self.$equipmenttype.$id.value = equipmenttypeid! | |||||
| self.$fluid.$id.value = fluidid! | |||||
| self.$fuel.$id.value = fuelid! | |||||
| self.$gate.$id.value = gateid! | |||||
| self.$incompletereason.$id.value = incompletereasonid! | |||||
| self.$inputtype.$id.value = inputtypeid! | |||||
| self.$inspectionitem.$id.value = inspectionitemid! | |||||
| self.$inspectionitemresponse.$id.value = inspectionitemresponseid! | |||||
| self.$inspectionlevel.$id.value = inspectionlevelid! | |||||
| self.$inspectiontype.$id.value = inspectiontypeid! | |||||
| self.$item.$id.value = itemid! | |||||
| self.$itemresponsetype.$id.value = itemresponsetypeid! | |||||
| self.createuserid = createuserid | |||||
| self.updateuserid = updateuserid | |||||
| } | |||||
| } | |||||
| extension mdlTblValue{ | |||||
| struct Create: AsyncMigration { | |||||
| func prepare(on database: Database) async throws { | |||||
| try await database.schema("tblValue") | |||||
| .field("id", .int, .identifier(auto: true)) | |||||
| .field("field", .string) | |||||
| .field("value", .string) | |||||
| .field("localeId", .int, .references("locale", "id")) | |||||
| .field("categoryId", .int, .references("category", "id")) | |||||
| .field("comparisonTypeId", .int, .references("comparisonType", "id")) | |||||
| .field("createDate", .datetime) | |||||
| .field("createUserId", .int) | |||||
| .field("updateDate", .datetime) | |||||
| .field("updateUserId", .int) | |||||
| .create() | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await database.schema("tblValue").delete() | |||||
| } | |||||
| } | |||||
| struct AddOptionalParents: AsyncMigration { | |||||
| func prepare(on database: Database) async throws { | |||||
| try await database.schema("tblValue") | |||||
| .field("compartmentId", .int, .references("compartment", "id")) | |||||
| .field("compartmentLocationId", .int, .references("compartmentLocation", "id")) | |||||
| .field("contactTypeId", .int, .references("contactType", "id")) | |||||
| .field("dataTypeId", .int, .references("dataType", "id")) | |||||
| .field("divisionId", .int, .references("division", "id")) | |||||
| .field("equipmentTypeId", .int, .references("equipmentType", "id")) | |||||
| .field("fluidId", .int, .references("fluid", "id")) | |||||
| .field("fuelId", .int, .references("fuel", "id")) | |||||
| .field("gateId", .int, .references("gate", "id")) | |||||
| .field("incompleteReasonId", .int, .references("incompleteReason", "id")) | |||||
| .field("inputTypeId", .int, .references("inputType", "id")) | |||||
| .field("inspectionItemId", .int, .references("inspectionItemId", "id")) | |||||
| .field("inspectionItemResponseId", .int, .references("inspectionItemResposne", "id")) | |||||
| .field("inspectionLevelId", .int, .references("inspectionLevel", "id")) | |||||
| .field("inspectionTypeId", .int, .references("inspectionType", "id")) | |||||
| .field("itemId", .int, .references("item", "id")) | |||||
| .field("itemResponseTypeId", .int, .references("itemResponseType", "id")) | |||||
| .update() | |||||
| } | |||||
| func revert(on database: Database) async throws { | |||||
| try await database.schema("tblValue") | |||||
| .deleteField("compartmentId") | |||||
| .deleteField("compartmentLocationId") | |||||
| .deleteField("contactTypeId") | |||||
| .deleteField("dataTypeId") | |||||
| .deleteField("divisionId") | |||||
| .deleteField("equipmentTypeId") | |||||
| .deleteField("fluidId") | |||||
| .deleteField("fuelId") | |||||
| .deleteField("gateId") | |||||
| .deleteField("incompleteReasonId") | |||||
| .deleteField("inputTypeId") | |||||
| .deleteField("inspectionItemId") | |||||
| .deleteField("inspectionItemResponseId") | |||||
| .deleteField("inspectionLevelId") | |||||
| .deleteField("inspectionTypeId") | |||||
| .deleteField("itemResponseTypeId") | |||||
| .update() | |||||
| } | |||||
| } | |||||
| public static func ObjQuery(req: Request) async throws -> QueryBuilder<mdlTblValue>{ | |||||
| let query = mdlTblValue.query(on: req.db) | |||||
| .with(\.$locale) | |||||
| .with(\.$category) | |||||
| .with(\.$comparisontype) | |||||
| .with(\.$compartment) | |||||
| .with(\.$compartmentlocation) | |||||
| .with(\.$contacttype) | |||||
| .with(\.$datatype) | |||||
| .with(\.$division) | |||||
| .with(\.$equipmenttype) | |||||
| .with(\.$fluid) | |||||
| .with(\.$fuel) | |||||
| .with(\.$gate) | |||||
| .with(\.$incompletereason) | |||||
| .with(\.$inputtype) | |||||
| .with(\.$inspectionitem) | |||||
| .with(\.$inspectionitemresponse) | |||||
| .with(\.$inspectionlevel) | |||||
| .with(\.$inspectiontype) | |||||
| .with(\.$item) | |||||
| .with(\.$itemresponsetype) | |||||
| if let x = req.parameters.get("x"){ | |||||
| let decryptedString = try CustomCrypto.DecryptString(input: x) | |||||
| let array = decryptedString.components(separatedBy: ":") | |||||
| ///This call is the standard get by id call | |||||
| if (array.count == 1){ | |||||
| let id = Int(array[0])! | |||||
| return query.filter(\.$id == id) | |||||
| } | |||||
| ///Optional else if if there are multiple parameters in the call | |||||
| ///You must include an else for each call that has parameters | |||||
| ///Need to check the endpoint to get the right filter statements | |||||
| ///else if(x.count == 2){ | |||||
| /// let username = x[0] | |||||
| /// let password = x[1] | |||||
| /// return query.filter(\.$username == username).filter(\.$password == password) | |||||
| ///} | |||||
| else{ | |||||
| throw Abort(.badRequest) | |||||
| } | |||||
| } | |||||
| else{ | |||||
| return query | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -6,6 +6,14 @@ import Foundation | |||||
| // configures your application | // configures your application | ||||
| public func configure(_ app: Application) async throws { | public func configure(_ app: Application) async throws { | ||||
| switch app.environment{ | |||||
| case .testing: | |||||
| app.passwords.use(.plaintext) | |||||
| case .development: | |||||
| app.passwords.use(.plaintext) | |||||
| default: | |||||
| app.passwords.use(.bcrypt) | |||||
| } | |||||
| // uncomment to serve files from /Public folder | // uncomment to serve files from /Public folder | ||||
| app.middleware.use(CORSMiddleware()) | app.middleware.use(CORSMiddleware()) | ||||
| let corsConfiguration = CORSMiddleware.Configuration( | let corsConfiguration = CORSMiddleware.Configuration( | ||||
| @@ -31,6 +39,13 @@ public func configure(_ app: Application) async throws { | |||||
| let timeout = HTTPClient.Configuration.Timeout(connect: .seconds(300), read: .seconds(300) ) | let timeout = HTTPClient.Configuration.Timeout(connect: .seconds(300), read: .seconds(300) ) | ||||
| app.http.client.configuration.timeout = timeout | app.http.client.configuration.timeout = timeout | ||||
| app.migrations.add(mdlSysOfMeasure.Create()) | |||||
| app.migrations.add(mdlSysOfMeasure.Seed()) | |||||
| app.migrations.add(mdlSysCategory.Create()) | |||||
| app.migrations.add(mdlSysCategory.Seed()) | |||||
| app.migrations.add(mdlSysUOM.Create()) | |||||
| app.migrations.add(mdlSysUOM.Seed()) | |||||
| app.migrations.add(mdlCategory.Create()) | app.migrations.add(mdlCategory.Create()) | ||||
| app.migrations.add(mdlComparisonType.Create()) | app.migrations.add(mdlComparisonType.Create()) | ||||
| @@ -159,6 +174,10 @@ public func configure(_ app: Application) async throws { | |||||
| //app.migrations.add(mdlInspection.Update()) | //app.migrations.add(mdlInspection.Update()) | ||||
| app.migrations.add(mdlInspection.Mod3()) | app.migrations.add(mdlInspection.Mod3()) | ||||
| app.migrations.add(mdlInspectionCategory.Mod1()) | app.migrations.add(mdlInspectionCategory.Mod1()) | ||||
| app.migrations.add(mdlUser.Customer()) | |||||
| app.migrations.add(mdlLocale.Create()) | |||||
| app.migrations.add(mdlLocale.Seed()) | |||||
| app.migrations.add(mdlTblValue.Create()) | |||||
| app.logger.logLevel = .debug | app.logger.logLevel = .debug | ||||
| @@ -11,7 +11,7 @@ func routes(_ app: Application) throws { | |||||
| app.routes.caseInsensitive = true | app.routes.caseInsensitive = true | ||||
| app.routes.defaultMaxBodySize = "64mb"; | app.routes.defaultMaxBodySize = "64mb"; | ||||
| let baseApp = app.grouped("api").grouped("v2.0") | let baseApp = app.grouped("api").grouped("v2.0") | ||||
| let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String | |||||
| _ = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String | |||||
| baseApp.get { req async in | baseApp.get { req async in | ||||
| "Connexion Mobile Services Version 2.0" | "Connexion Mobile Services Version 2.0" | ||||
| } | } | ||||