30 lines
797 B
Python
30 lines
797 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from geoObjects import Vehicle
|
|
|
|
class VehicleHandler:
|
|
__dbSession: Session
|
|
|
|
def __init__(self, session:Session):
|
|
self.__dbSession = session
|
|
pass
|
|
|
|
# handles creating a vehicle and storing it in the database
|
|
def createVehicle(self, name:str, type:str):
|
|
if not name:
|
|
raise ValueError("name is empty")
|
|
|
|
if not type:
|
|
raise ValueError("vehicle is empty")
|
|
|
|
self.__dbSession.add(Vehicle(name, type))
|
|
self.__dbSession.commit()
|
|
pass
|
|
|
|
# handles getting a vehicle identified with its id from the database
|
|
def getVehicle(self, id:int):
|
|
pass
|
|
|
|
# handles getting all vehicles from database
|
|
def getVehicles(self):
|
|
pass |