26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from sqlalchemy import Column, Integer, String, DateTime, Float
|
|
from datetime import datetime
|
|
from ..database import Base
|
|
|
|
|
|
class Truck(Base):
|
|
"""Flotilla de recolección de basura del Gobierno de Celaya."""
|
|
__tablename__ = "trucks"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
unit_number = Column(String, unique=True, index=True, nullable=False) # CEL-001
|
|
plate = Column(String, unique=True, nullable=True) # GTO-123-A
|
|
model = Column(String, nullable=True)
|
|
year = Column(Integer, nullable=True)
|
|
capacity_kg = Column(Integer, nullable=True)
|
|
fuel_type = Column(String, default="DIESEL")
|
|
status = Column(String, default="OPERATIVO")
|
|
# OPERATIVO | EN_RUTA | TALLER | MANTENIMIENTO | FUERA_SERVICIO | RESERVA
|
|
route_id = Column(String, nullable=True, index=True)
|
|
base = Column(String, nullable=True) # Patio Norte | Patio Sur | etc.
|
|
odometer_km = Column(Integer, default=0)
|
|
fuel_level_pct = Column(Integer, default=80)
|
|
last_maintenance = Column(DateTime, nullable=True)
|
|
next_maintenance_km = Column(Integer, nullable=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|