Просмотр исходного кода

fix for null downloaded

v2_uploadImages
Mike Carman 1 год назад
Родитель
Сommit
ee94988698
3 измененных файлов: 3 добавлений и 3 удалений
  1. Двоичные данные
      .swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate
  2. +2
    -2
      Sources/App/Controllers/FuelEntryV2Controller.swift
  3. +1
    -1
      Sources/App/configure.swift

Двоичные данные
.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate Просмотреть файл


+ 2
- 2
Sources/App/Controllers/FuelEntryV2Controller.swift Просмотреть файл

@@ -126,12 +126,12 @@ struct FuelEntryV2Controller: RouteCollection {
if(image){ if(image){
//query = query.filter(\.$image) //query = query.filter(\.$image)
let wimage = try await query.paginate(for: req).map{ 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) 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, 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) return try await woimage.encodeResponse(for: req)
} }


+ 1
- 1
Sources/App/configure.swift Просмотреть файл

@@ -10,7 +10,7 @@ public func configure(_ app: Application) async throws {
app.routes.defaultMaxBodySize = "128mb" app.routes.defaultMaxBodySize = "128mb"
// 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.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( // app.databases.use(DatabaseConfigurationFactory.postgres(configuration: .init(
// hostname: Environment.get("DATABASE_HOST") ?? "localhost", // hostname: Environment.get("DATABASE_HOST") ?? "localhost",
// port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? 5433, // port: Environment.get("DATABASE_PORT").flatMap(Int.init(_:)) ?? 5433,


Загрузка…
Отмена
Сохранить