| @@ -14,8 +14,8 @@ | |||||
| filePath = "Sources/App/Models/FuelEntry.swift" | filePath = "Sources/App/Models/FuelEntry.swift" | ||||
| startingColumnNumber = "9223372036854775807" | startingColumnNumber = "9223372036854775807" | ||||
| endingColumnNumber = "9223372036854775807" | endingColumnNumber = "9223372036854775807" | ||||
| startingLineNumber = "213" | |||||
| endingLineNumber = "213" | |||||
| startingLineNumber = "215" | |||||
| endingLineNumber = "215" | |||||
| landmarkName = "init(id:timestamp:userID:latitude:longitude:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:tabletserial:)" | landmarkName = "init(id:timestamp:userID:latitude:longitude:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:tabletserial:)" | ||||
| landmarkType = "7"> | landmarkType = "7"> | ||||
| </BreakpointContent> | </BreakpointContent> | ||||
| @@ -30,8 +30,8 @@ | |||||
| filePath = "Sources/App/Models/FuelEntry.swift" | filePath = "Sources/App/Models/FuelEntry.swift" | ||||
| startingColumnNumber = "9223372036854775807" | startingColumnNumber = "9223372036854775807" | ||||
| endingColumnNumber = "9223372036854775807" | endingColumnNumber = "9223372036854775807" | ||||
| startingLineNumber = "193" | |||||
| endingLineNumber = "193" | |||||
| startingLineNumber = "195" | |||||
| endingLineNumber = "195" | |||||
| landmarkName = "init(id:timestamp:userID:latitude:longitude:image:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:tabletserial:)" | landmarkName = "init(id:timestamp:userID:latitude:longitude:image:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:tabletserial:)" | ||||
| landmarkType = "7"> | landmarkType = "7"> | ||||
| </BreakpointContent> | </BreakpointContent> | ||||
| @@ -46,11 +46,107 @@ | |||||
| filePath = "Sources/App/Models/FuelEntry.swift" | filePath = "Sources/App/Models/FuelEntry.swift" | ||||
| startingColumnNumber = "9223372036854775807" | startingColumnNumber = "9223372036854775807" | ||||
| endingColumnNumber = "9223372036854775807" | endingColumnNumber = "9223372036854775807" | ||||
| startingLineNumber = "173" | |||||
| endingLineNumber = "173" | |||||
| startingLineNumber = "175" | |||||
| endingLineNumber = "175" | |||||
| landmarkName = "init(id:timestamp:userID:latitude:longitude:image:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:downloaded:tabletserial:)" | landmarkName = "init(id:timestamp:userID:latitude:longitude:image:product:make:model:serialNumber:tankID:fuelAmount:fuelType:isOverride:downloaded:tabletserial:)" | ||||
| landmarkType = "7"> | landmarkType = "7"> | ||||
| </BreakpointContent> | </BreakpointContent> | ||||
| </BreakpointProxy> | </BreakpointProxy> | ||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "D9ECF7FA-C31F-4E3E-A5E0-09B15672960B" | |||||
| shouldBeEnabled = "No" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "469" | |||||
| endingLineNumber = "469" | |||||
| landmarkName = "filtered(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "FCC6E6E2-0876-4286-93D8-266C58EAE0FE" | |||||
| shouldBeEnabled = "No" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "491" | |||||
| endingLineNumber = "491" | |||||
| landmarkName = "filtered(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "0BD134C2-3EF8-4F87-A31F-13B3E66DE82C" | |||||
| shouldBeEnabled = "No" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "511" | |||||
| endingLineNumber = "511" | |||||
| landmarkName = "filtered(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "44A1C379-F3B1-438B-9427-C87E053877C5" | |||||
| shouldBeEnabled = "No" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "529" | |||||
| endingLineNumber = "529" | |||||
| landmarkName = "filtered(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "9959EDC1-617C-4BD3-A47D-FA6774BA18A9" | |||||
| shouldBeEnabled = "Yes" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "547" | |||||
| endingLineNumber = "547" | |||||
| landmarkName = "filtered(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| <BreakpointProxy | |||||
| BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |||||
| <BreakpointContent | |||||
| uuid = "C4228ECF-D80C-49F9-BBD8-A33956D74C07" | |||||
| shouldBeEnabled = "Yes" | |||||
| ignoreCount = "0" | |||||
| continueAfterRunningActions = "No" | |||||
| filePath = "Sources/App/Controllers/FuelEntryV2Controller.swift" | |||||
| startingColumnNumber = "9223372036854775807" | |||||
| endingColumnNumber = "9223372036854775807" | |||||
| startingLineNumber = "291" | |||||
| endingLineNumber = "291" | |||||
| landmarkName = "filterLoadDate(req:)" | |||||
| landmarkType = "7"> | |||||
| </BreakpointContent> | |||||
| </BreakpointProxy> | |||||
| </Breakpoints> | </Breakpoints> | ||||
| </Bucket> | </Bucket> | ||||
| @@ -484,6 +484,7 @@ struct FuelEntryV2Controller: RouteCollection { | |||||
| .field(\.$image) | .field(\.$image) | ||||
| .field(\.$downloaded) | .field(\.$downloaded) | ||||
| .field(\.$loaddate) | .field(\.$loaddate) | ||||
| .field(\.$tabletserial) | |||||
| //.filter(\.$image != nil) | //.filter(\.$image != nil) | ||||
| } else { | } else { | ||||
| @@ -502,6 +503,7 @@ struct FuelEntryV2Controller: RouteCollection { | |||||
| .field(\.$latitude) | .field(\.$latitude) | ||||
| .field(\.$longitude) | .field(\.$longitude) | ||||
| .field(\.$downloaded) | .field(\.$downloaded) | ||||
| .field(\.$tabletserial) | |||||
| .field(\.$loaddate) | .field(\.$loaddate) | ||||
| } | } | ||||
| @@ -540,7 +542,7 @@ struct FuelEntryV2Controller: RouteCollection { | |||||
| return try await wimage.encodeResponse(for: req) | return try await wimage.encodeResponse(for: req) | ||||
| } else { | } else { | ||||
| let woimage = try await query.paginate(for: req).map{ | let woimage = try await query.paginate(for: req).map{ | ||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: previous == true ? img.pulldate : Date()) | |||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: previous == true ? img.pulldate : Date(), useremail: img.tabletserial) | |||||
| } | } | ||||
| if(!previous) { | if(!previous) { | ||||
| woimage.items.forEach { | woimage.items.forEach { | ||||
| @@ -632,7 +634,7 @@ struct FuelEntryV2Controller: RouteCollection { | |||||
| return try await wimage.encodeResponse(for: req) | return try await wimage.encodeResponse(for: req) | ||||
| } else { | } else { | ||||
| let woimage = try await query.paginate(for: req).map{ | let woimage = try await query.paginate(for: req).map{ | ||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: Date()) | |||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: Date(), useremail: img.tabletserial) | |||||
| } | } | ||||
| return try await woimage.encodeResponse(for: req) | return try await woimage.encodeResponse(for: req) | ||||
| } | } | ||||
| @@ -757,7 +759,7 @@ struct FuelEntryV2Controller: RouteCollection { | |||||
| return try await wimage.encodeResponse(for: req) | return try await wimage.encodeResponse(for: req) | ||||
| } else { | } else { | ||||
| let woimage = try await query.paginate(for: req).map{ | let woimage = try await query.paginate(for: req).map{ | ||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: Date()) | |||||
| img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitude: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, image: nil, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!, loaddate: img.loaddate == nil ? nil : img.loaddate, pulldate: Date(), useremail: img.tabletserial) | |||||
| } | } | ||||
| return try await woimage.encodeResponse(for: req) | return try await woimage.encodeResponse(for: req) | ||||
| } | } | ||||
| @@ -29,6 +29,7 @@ final class FuelEntry: Model, Content { | |||||
| let downloaded: Bool? | let downloaded: Bool? | ||||
| let loaddate: Date? | let loaddate: Date? | ||||
| let pulldate: Date? | let pulldate: Date? | ||||
| let useremail: String? | |||||
| func toFuelEntry() -> FuelEntry { | func toFuelEntry() -> FuelEntry { | ||||
| let entry = FuelEntry() | let entry = FuelEntry() | ||||
| entry.id = self.id | entry.id = self.id | ||||
| @@ -49,6 +50,7 @@ final class FuelEntry: Model, Content { | |||||
| entry.loaddate = self.loaddate | entry.loaddate = self.loaddate | ||||
| entry.pulldate = self.pulldate | entry.pulldate = self.pulldate | ||||
| entry._$idExists = self.id == nil ? false : true | entry._$idExists = self.id == nil ? false : true | ||||
| entry.tabletserial = self.useremail | |||||
| return entry | return entry | ||||
| } | } | ||||
| } | } | ||||
| @@ -13,6 +13,7 @@ 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 | ||||
| // let envHost = Environment.get("DATABASE_HOST") ?? "vapor.prelub.com" | |||||
| let envHost = Environment.get("DATABASE_HOST") ?? "127.0.0.1" | let envHost = Environment.get("DATABASE_HOST") ?? "127.0.0.1" | ||||
| var envPort: Int | var envPort: Int | ||||
| switch app.environment { | switch app.environment { | ||||