Selaa lähdekoodia

fix for null downloaded

v2_uploadImages
Mike Carman 1 vuosi sitten
vanhempi
commit
ee94988698
3 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. BIN
      .swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate
  2. +2
    -2
      Sources/App/Controllers/FuelEntryV2Controller.swift
  3. +1
    -1
      Sources/App/configure.swift

BIN
.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate Näytä tiedosto


+ 2
- 2
Sources/App/Controllers/FuelEntryV2Controller.swift Näytä tiedosto

@@ -126,12 +126,12 @@ struct FuelEntryV2Controller: RouteCollection {
if(image){
//query = query.filter(\.$image)
let wimage = try await query.paginate(for: req).map{
img in FuelEntry.wimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitutde: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, isOverride: img.isOverride, image: img.image == nil ? Data(): img.image, downloaded: img.downloaded!)
img in FuelEntry.wimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitutde: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, isOverride: img.isOverride, image: img.image == nil ? Data(): img.image, downloaded: img.downloaded == nil ? false : img.downloaded!)
}
return try await wimage.encodeResponse(for: req)
} else {
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, longitutde: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, isOverride: img.isOverride, downloaded: img.downloaded!)
img in FuelEntry.woimage(id: img.id, timestamp: img.timestamp, userID: img.userID, latitude: img.latitude, longitutde: img.longitude, product: img.product, make: img.make, model: img.model, serialNumber: img.serialNumber, tankID: img.tankID, fuelAmount: img.fuelAmount, fuelType: img.fuelType, isOverride: img.isOverride, downloaded: img.downloaded == nil ? false : img.downloaded!)
}
return try await woimage.encodeResponse(for: req)
}


+ 1
- 1
Sources/App/configure.swift Näytä tiedosto

@@ -10,7 +10,7 @@ public func configure(_ app: Application) async throws {
app.routes.defaultMaxBodySize = "128mb"
// let timeout = HTTPClient.Configuration.Timeout(connect: .seconds(300), read: .seconds(300))
// app.http.client.configuration.timeout = timeout
app.databases.use(.postgres(hostname: "127.0.0.1", port: 5432, username: "mcarman", password: "@ng31F@rm0823262", database: "fueling"), as: .psql)
app.databases.use(.postgres(hostname: "127.0.0.1", port: 5433, username: "mcarman", password: "@ng31F@rm0823262", database: "fueling"), as: .psql)
// app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
// hostname: Environment.get("DATABASE_HOST") ?? "localhost",
// port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? 5433,


Ladataan…
Peruuta
Tallenna