diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate index 9007c51..6bb1f3f 100644 Binary files a/.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate and b/.swiftpm/xcode/package.xcworkspace/xcuserdata/mcarman.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/.swiftpm/xcode/xcuserdata/mcarman.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/.swiftpm/xcode/xcuserdata/mcarman.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 0776a4d..6ab0bbc 100644 --- a/.swiftpm/xcode/xcuserdata/mcarman.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/.swiftpm/xcode/xcuserdata/mcarman.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -164,5 +164,223 @@ landmarkType = "9"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/App/Controllers/V2.1/FuelEntryControllerV2_1.swift b/Sources/App/Controllers/V2.1/FuelEntryControllerV2_1.swift index c35dc19..e2125b5 100644 --- a/Sources/App/Controllers/V2.1/FuelEntryControllerV2_1.swift +++ b/Sources/App/Controllers/V2.1/FuelEntryControllerV2_1.swift @@ -644,7 +644,7 @@ struct FuelEntryV2ControllerV2_1: RouteCollection { - func create(req: Request) async throws -> [FuelEntry] { + func create(req: Request) async throws -> Response { let fuelEntry = try req.content.decode([FuelEntry.V2_1_Input].self) var results: [FuelEntry] = [] for entry in fuelEntry { @@ -662,14 +662,13 @@ struct FuelEntryV2ControllerV2_1: RouteCollection { } } - input.save(on: req.db).whenFailure({ error in - - }) + try await input.save(on: req.db) results.append(input) } // try await fuelEntry.create(on: req.db) - return results + let response = try await results.encodeResponse(for: req) + return response } diff --git a/Sources/App/DTO/V2.1/FuelEntryDTO.swift b/Sources/App/DTO/V2.1/FuelEntryDTO.swift index 1247463..5b82d0e 100644 --- a/Sources/App/DTO/V2.1/FuelEntryDTO.swift +++ b/Sources/App/DTO/V2.1/FuelEntryDTO.swift @@ -24,6 +24,7 @@ extension FuelEntry { var model: String? var tankId: String? var image: Data? + var userId: String? } struct V2_1_Output: Content { diff --git a/Sources/App/Models/FuelEntry.swift b/Sources/App/Models/FuelEntry.swift index eda0fd5..108fba5 100755 --- a/Sources/App/Models/FuelEntry.swift +++ b/Sources/App/Models/FuelEntry.swift @@ -287,7 +287,9 @@ final class FuelEntry: Model, Content { self.make = decoder.make ?? "" self.model = decoder.model ?? "" self.tankID = decoder.tankId ?? "" + self.userID = decoder.userId ?? "" self.image = decoder.image - + self.tabletserial = decoder.tabletSerial ?? "" + self.downloaded = false } }