from sqlalchemy import Column, Float, Integer, String, ForeignKey, DateTime, LargeBinary from sqlalchemy.orm import relationship from db.base import Base class FuelingTask(Base): Id = Column(Integer, primary_key=True, index=True) VehicleId = Column(ForeignKey("vehicle.Id"), nullable=False) DriverId = Column(ForeignKey("user.Id"), nullable=False) CreatedById = Column(ForeignKey("user.Id"), nullable=False) Date = Column(DateTime, nullable=False) Description = Column(String, nullable=True) Cost = Column(Integer, nullable=False) FuelRefilled = Column(Float, nullable=False) GasStationName = Column(String, nullable=False) ImageBefore = Column(LargeBinary, nullable=False) ImageAfter = Column(LargeBinary, nullable=False) CreatedBy = relationship( "User", back_populates="fuelingTasks", foreign_keys="FuelingTask.CreatedById" )