|
@@ -76,23 +76,23 @@ def replace_vehicle_data(id: int, vehicle: UpdateVehicle, db: Session): |
|
|
vehicle_object = vehicle_db.first() |
|
|
vehicle_object = vehicle_db.first() |
|
|
if not vehicle_object: |
|
|
if not vehicle_object: |
|
|
return "vehiclenotfound" |
|
|
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.Mileage = vehicle.Mileage |
|
|
vehicle_object.Model = vehicle.Model |
|
|
|
|
|
|
|
|
#vehicle_object.Model = vehicle.Model |
|
|
vehicle_object.Status = vehicle.Status |
|
|
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) |
|
|
print(vehicle_object) |
|
|
db.add(vehicle_object) |
|
|
db.add(vehicle_object) |
|
|
db.commit() |
|
|
db.commit() |
|
|
vehicle_object.AssignedDriver = vehicle.AssignedDriver |
|
|
|
|
|
|
|
|
#vehicle_object.AssignedDriver = vehicle.AssignedDriver |
|
|
return vehicle_object |
|
|
return vehicle_object |
|
|
|
|
|
|
|
|
|
|
|
|
|
|