From 150031c9a859750e8ca6b875d5bff46ebc142c2b Mon Sep 17 00:00:00 2001 From: Madiwka Date: Sun, 22 Oct 2023 15:05:25 +0600 Subject: [PATCH] DriverUpdate --- app/db/repository/vehicle.py | 24 ++++++++++++------------ app/schemas/vehicle.py | 6 ++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/db/repository/vehicle.py b/app/db/repository/vehicle.py index 748ce69..412faec 100644 --- a/app/db/repository/vehicle.py +++ b/app/db/repository/vehicle.py @@ -76,23 +76,23 @@ def replace_vehicle_data(id: int, vehicle: UpdateVehicle, db: Session): vehicle_object = vehicle_db.first() if not vehicle_object: return "vehiclenotfound" - vehicle_object.CurrentLocation = vehicle.CurrentLocation - vehicle_object.Fuel = vehicle.Fuel - vehicle_object.LicensePlate = vehicle.LicensePlate - vehicle_object.DriverHistory = vehicle.DriverHistory - vehicle_object.Type = vehicle.Type + #vehicle_object.CurrentLocation = vehicle.CurrentLocation + #vehicle_object.Fuel = vehicle.Fuel + #vehicle_object.LicensePlate = vehicle.LicensePlate + #vehicle_object.DriverHistory = vehicle.DriverHistory + #vehicle_object.Type = vehicle.Type vehicle_object.Mileage = vehicle.Mileage - vehicle_object.Model = vehicle.Model + #vehicle_object.Model = vehicle.Model vehicle_object.Status = vehicle.Status - res = assign_vehicle_driver(id, vehicle.AssignedDriver, db) - if res == "nodriver": - return "driverNotFound" - vehicle_object.Capacity = vehicle.Capacity - vehicle_object.Year = vehicle.Year + #res = assign_vehicle_driver(id, vehicle.AssignedDriver, db) + #if res == "nodriver": + # return "driverNotFound" + #vehicle_object.Capacity = vehicle.Capacity + #vehicle_object.Year = vehicle.Year print(vehicle_object) db.add(vehicle_object) db.commit() - vehicle_object.AssignedDriver = vehicle.AssignedDriver + #vehicle_object.AssignedDriver = vehicle.AssignedDriver return vehicle_object diff --git a/app/schemas/vehicle.py b/app/schemas/vehicle.py index e441adb..6511512 100644 --- a/app/schemas/vehicle.py +++ b/app/schemas/vehicle.py @@ -26,8 +26,10 @@ class OutputVehicle(BaseModel): Status: str -class UpdateVehicle(OutputVehicle): - pass +class UpdateVehicle(BaseModel): + Mileage: int + Status: str + class VehicleLocation(BaseModel):