M0: implement operational core
Backend: SQLAlchemy models, Alembic migrations, requirements lockfile. Frontend: pinned deps, package-lock, vite-env types fix. Verified compose build/health, pytest, ruff clean.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import Boolean, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.db import Base
|
||||
from app.models.mixins import TimestampMixin, UUIDPrimaryKeyMixin
|
||||
|
||||
OPERATIONAL_STATUSES = ("available", "rented", "cleaning", "maintenance", "blocked")
|
||||
|
||||
|
||||
class Vehicle(UUIDPrimaryKeyMixin, TimestampMixin, Base):
|
||||
__tablename__ = "vehicles"
|
||||
|
||||
public_ref: Mapped[str] = mapped_column(String(20), unique=True, nullable=False)
|
||||
make: Mapped[str] = mapped_column(String(80), nullable=False)
|
||||
model: Mapped[str] = mapped_column(String(80), nullable=False)
|
||||
model_year: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
registration_number: Mapped[str] = mapped_column(String(40), unique=True, nullable=False)
|
||||
location: Mapped[str] = mapped_column(String(120), nullable=False)
|
||||
operational_status: Mapped[str] = mapped_column(String(20), nullable=False)
|
||||
odometer_km: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
next_service_km: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||
version: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
||||
Reference in New Issue
Block a user