fix: 🐛 fixed issue in both back and frontend that would prevent geojson data from beeing loaded
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from errors.NotFoundException import NotFoundError
|
||||
from modules.geoObjects import Driver
|
||||
|
||||
|
||||
@ -27,14 +28,13 @@ class DriverHandler:
|
||||
raise RuntimeError(f"failed to create driver with errors{e}")
|
||||
|
||||
# handles getting a driver by its id from the database
|
||||
def getDriver(self, driverID: int):
|
||||
def getDriver(self, driverID: int) -> Driver:
|
||||
try:
|
||||
driver = self.dbSession.query(Driver).filter_by(id=driverID).first()
|
||||
|
||||
return {
|
||||
"id": driver.id,
|
||||
"name": driver.name
|
||||
}
|
||||
if driver:
|
||||
return driver
|
||||
else:
|
||||
raise NotFoundError(f"Driver with ID {driverID} not found", errors=[])
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"failed to get driver with errors{e}")
|
||||
|
||||
|
Reference in New Issue
Block a user