mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 11:19:57 +00:00
33 lines
758 B
Python
33 lines
758 B
Python
from datetime import datetime
|
|
from application import db
|
|
|
|
|
|
# db classes
|
|
class Plate(db.Model):
|
|
__abstract__ = True
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
plate = db.Column(db.String(40), nullable=False)
|
|
|
|
|
|
class LoggedItem(Plate):
|
|
__tablename__ = "LoggedItems"
|
|
dateLogged = db.Column(db.DateTime, nullable=False)
|
|
allowed = db.Column(db.Boolean, nullable=False, server_default=db.false())
|
|
|
|
def __init__(
|
|
self,
|
|
plate: str,
|
|
datetime: datetime,
|
|
allowed: bool = False,
|
|
):
|
|
self.plate = plate
|
|
self.allowed = allowed
|
|
self.dateLogged = datetime
|
|
|
|
|
|
class AllowedPlate(Plate):
|
|
__tablename__ = "AllowedPlates"
|
|
|
|
def __init__(self, plate: str):
|
|
self.plate = plate
|