Madiwka преди 1 година
родител
ревизия
245bd2de86
променени са 6 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. +1
    -0
      app/db/base.py
  2. +2
    -1
      app/db/models/auction.py
  3. +0
    -0
      app/db/models/fuelingtask.py
  4. +1
    -1
      app/db/models/maintenancejob.py
  5. +3
    -3
      app/db/models/user.py
  6. +2
    -0
      app/db/models/vehicle.py

+ 1
- 0
app/db/base.py Целия файл

@@ -5,3 +5,4 @@ from db.models.vehicle import Vehicle
from db.models.carpart import CarPart
from db.models.maintenancejob import MaintenanceJob
from db.models.drivetask import DriveTask
from db.models.auction import Auction

+ 2
- 1
app/db/models/auction.py Целия файл

@@ -8,8 +8,9 @@ class Auction(Base):
initialPrice = Column(Integer, nullable=False)
minimalBet = Column(Integer, nullable=False)
carID = Column(Integer, ForeignKey("car.Id"), nullable=False)
carID = Column(Integer, ForeignKey("vehicle.Id"), nullable=False)
vehicle = relationship("Vehicle", back_populates="auction")
creatorId = Column(Integer, ForeignKey("user.Id"), nullable=False)
CreatedBy = relationship("User", back_populates="auctions")
dateStart = Column(DateTime, nullable=False)
dateEnd = Column(DateTime, nullable=False)


+ 0
- 0
app/db/models/fuelingtask.py Целия файл


+ 1
- 1
app/db/models/maintenancejob.py Целия файл

@@ -7,7 +7,7 @@ class MaintenanceJob(Base):
Id = Column(Integer, primary_key=True, index=True)
# a list of weak entities of class CarPart
CarParts = relationship("CarPart", back_populates="parent")
CreatedBy = relationship("MaintenancePerson", back_populates="maintenanceJobs")
CreatedBy = relationship("User", back_populates="maintenanceJobs")
Description = Column(String, nullable=False)
Date = Column(DateTime, nullable=False)
MaintenanceWorker = Column(ForeignKey("user.Id"), nullable=False)

+ 3
- 3
app/db/models/user.py Целия файл

@@ -18,14 +18,14 @@ class User(Base):
#Admin-specific relationships
CreatedAuctions = relationship("Auction", back_populates="CreatedBy")
auctions = relationship("Auction", back_populates="CreatedBy")
#Driver-specific relationships
DrivingLicenseNumber = Column(String, nullable=True)
AssignedVehicle = Column(Integer, ForeignKey("vehicle.Id"), nullable=True)
DriveTasks = relationship("DriveTask", back_populates="CreatedBy")
driveTasks = relationship("DriveTask", back_populates="CreatedBy")
vehicle = relationship("Vehicle", back_populates="driver")
#MaintenancePerson-specific relationships
maintenanceJobs = relationship("MaintenanceJob", back_populates="CreatedBy")
#FuelingPerson-specific relationships
fuelingJobs = relationship("FuelingJob", back_populates="CreatedBy")
#fuelingJobs = relationship("FuelingJob", back_populates="CreatedBy")


+ 2
- 0
app/db/models/vehicle.py Целия файл

@@ -22,3 +22,5 @@ class Vehicle(Base):
Capacity = Column(Integer, nullable=False)
DriverHistory = Column(ARRAY(Integer), nullable=True)
driver = relationship("User", back_populates="vehicle")
auction = relationship("Auction", back_populates="vehicle")

Зареждане…
Отказ
Запис