Browse Source

Merge pull request #3 from Madiwka4/Madi

Fix
main
Madiwka 1 year ago
committed by GitHub
parent
commit
580ea7d46f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 5 deletions
  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 View File

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

+ 2
- 1
app/db/models/auction.py View File

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


+ 0
- 0
app/db/models/fuelingtask.py View File


+ 1
- 1
app/db/models/maintenancejob.py View File

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

+ 3
- 3
app/db/models/user.py View File

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



+ 2
- 0
app/db/models/vehicle.py View File

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

Loading…
Cancel
Save