|  |  | @@ -11,7 +11,7 @@ from db.repository.vehicle import ( | 
		
	
		
			
			|  |  |  | get_vehicle_by_id, | 
		
	
		
			
			|  |  |  | replace_vehicle_data, | 
		
	
		
			
			|  |  |  | delete_vehicle_data, | 
		
	
		
			
			|  |  |  | update_vehicle_location, | 
		
	
		
			
			|  |  |  | update_vehicle_geoloc, | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | from db.models.user import User | 
		
	
		
			
			|  |  |  | from apis.v1.route_auth import get_current_user | 
		
	
	
		
			
				|  |  | @@ -143,20 +143,24 @@ def delete_vehicle( | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | @router.post("/{vehicle_id}/location", status_code=status.HTTP_200_OK) | 
		
	
		
			
			|  |  |  | async def update_vehicle_location( | 
		
	
		
			
			|  |  |  | vehicle_id: int, | 
		
	
		
			
			|  |  |  | def update_vehicle_location( | 
		
	
		
			
			|  |  |  | vehicle_id: int, | 
		
	
		
			
			|  |  |  | location: VehicleLocation, | 
		
	
		
			
			|  |  |  | current_user: User = Depends(get_current_user), | 
		
	
		
			
			|  |  |  | db: Session = Depends(get_db), | 
		
	
		
			
			|  |  |  | db: Session = Depends(get_db), | 
		
	
		
			
			|  |  |  | ): | 
		
	
		
			
			|  |  |  | print(current_user) | 
		
	
		
			
			|  |  |  | print(current_user.Name) | 
		
	
		
			
			|  |  |  | if current_user.Role != "Driver": | 
		
	
		
			
			|  |  |  | raise HTTPException(status_code=403, detail="You are not authorized to perform this action") | 
		
	
		
			
			|  |  |  | if current_user.Role != "Driver": | 
		
	
		
			
			|  |  |  | raise HTTPException( | 
		
	
		
			
			|  |  |  | status_code=403, detail="You are not authorized to perform this action" | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | if current_user.AssignedVehicle != vehicle_id: | 
		
	
		
			
			|  |  |  | raise HTTPException(status_code=403, detail="You are not the correct car driver") | 
		
	
		
			
			|  |  |  | raise HTTPException( | 
		
	
		
			
			|  |  |  | status_code=403, detail="You are not the correct car driver" | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | print("FUNNY") | 
		
	
		
			
			|  |  |  | vehicle = update_vehicle_location(vehicle_id = vehicle_id, location=location, db=db) | 
		
	
		
			
			|  |  |  | vehicle = update_vehicle_geoloc(vehicle_id=vehicle_id, location=location, db=db) | 
		
	
		
			
			|  |  |  | if vehicle == "vehiclenotfound": | 
		
	
		
			
			|  |  |  | raise HTTPException(status_code=404, detail="Vehicle not found") | 
		
	
		
			
			|  |  |  | return vehicle | 
		
	
		
			
			|  |  |  | return vehicle |