Fixing ruff and mypy issues (#23)
Reviewed-on: #23 Co-authored-by: Andrew Kettel <andrew.kettel@gmail.com> Co-committed-by: Andrew Kettel <andrew.kettel@gmail.com>
This commit was merged in pull request #23.
This commit is contained in:
+14
-15
@@ -3,22 +3,24 @@ from __future__ import annotations
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped
|
||||
|
||||
db: SQLAlchemy = SQLAlchemy()
|
||||
from sqlalchemy import Boolean, DateTime, Integer, String
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
|
||||
db: SQLAlchemy = SQLAlchemy(model_class=Base)
|
||||
|
||||
|
||||
class CameraStatus(Base):
|
||||
__tablename__ = "camera_status"
|
||||
|
||||
id: Mapped[int] = db.mapped_column(db.Integer, primary_key=True)
|
||||
running: Mapped[bool] = db.mapped_column(db.Boolean, nullable=False, default=False)
|
||||
updated_at: Mapped[datetime] = db.mapped_column(
|
||||
db.DateTime(timezone=True),
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
running: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
default=lambda: datetime.now(UTC),
|
||||
)
|
||||
@@ -44,14 +46,11 @@ class CameraStatus(Base):
|
||||
|
||||
class CameraEvent(Base):
|
||||
__tablename__ = "camera_events"
|
||||
|
||||
id: Mapped[int] = db.mapped_column(db.Integer, primary_key=True)
|
||||
action: Mapped[str] = db.mapped_column(
|
||||
db.String(10), nullable=False
|
||||
) # 'start' | 'stop'
|
||||
ip_address: Mapped[str] = db.mapped_column(db.String(45), nullable=False)
|
||||
timestamp: Mapped[datetime] = db.mapped_column(
|
||||
db.DateTime(timezone=True),
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
action: Mapped[str] = mapped_column(String(10), nullable=False) # 'start' | 'stop'
|
||||
ip_address: Mapped[str] = mapped_column(String(45), nullable=False)
|
||||
timestamp: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
default=lambda: datetime.now(UTC),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user