Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

1 anno fa
1 anno fa
1 anno fa
1 anno fa
1 anno fa
11 mesi fa
1 anno fa
1 anno fa
12345678910111213141516171819202122232425262728293031
  1. # PostgreSQL table model for users
  2. from sqlalchemy import Column, Integer, String, ForeignKey
  3. from sqlalchemy.orm import relationship
  4. from db.base import Base
  5. class User(Base):
  6. Id = Column(Integer, primary_key=True, index=True)
  7. Name = Column(String, nullable=False)
  8. MiddleName = Column(String, nullable=True)
  9. LastName = Column(String, nullable=False)
  10. GovernmentId = Column(String, nullable=False)
  11. Address = Column(String, nullable=False)
  12. ContactNumber = Column(String, nullable=False)
  13. Email = Column(String, nullable=False)
  14. Role = Column(String, nullable=False)
  15. HashedPassword = Column(String, nullable=False)
  16. #Admin-specific relationships
  17. auctions = relationship("Auction", back_populates="CreatedBy")
  18. #Driver-specific relationships
  19. DrivingLicenseNumber = Column(String, nullable=True)
  20. AssignedVehicle = Column(Integer, ForeignKey("vehicle.Id"), nullable=True)
  21. driveTasks = relationship("DriveTask", back_populates="CreatedBy")
  22. vehicle = relationship("Vehicle", back_populates="driver")
  23. #MaintenancePerson-specific relationships
  24. maintenanceJobs = relationship("MaintenanceJob", back_populates="FinishedBy", foreign_keys="MaintenanceJob.MaintenanceWorker")
  25. #FuelingPerson-specific relationships
  26. fuelingTasks = relationship("FuelingTask", back_populates="CreatedBy", foreign_keys="FuelingTask.CreatedById")