Integration of sqlite3 database now fully functional with all implemented functions
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.database import Base # Ensure this imports correctly
|
||||
from app.database import Base
|
||||
|
||||
|
||||
# SQLAlchemy ORM models
|
||||
class Shipment(Base):
|
||||
__tablename__ = "shipments"
|
||||
|
||||
@ -21,7 +19,6 @@ class Shipment(Base):
|
||||
proposal = relationship("Proposal", back_populates="shipments")
|
||||
dewars = relationship("Dewar", back_populates="shipment")
|
||||
|
||||
|
||||
class ContactPerson(Base):
|
||||
__tablename__ = "contact_persons"
|
||||
|
||||
@ -33,7 +30,6 @@ class ContactPerson(Base):
|
||||
|
||||
shipments = relationship("Shipment", back_populates="contact_person")
|
||||
|
||||
|
||||
class Address(Base):
|
||||
__tablename__ = "addresses"
|
||||
|
||||
@ -45,7 +41,6 @@ class Address(Base):
|
||||
|
||||
shipments = relationship("Shipment", back_populates="return_address")
|
||||
|
||||
|
||||
class Dewar(Base):
|
||||
__tablename__ = "dewars"
|
||||
|
||||
@ -65,9 +60,8 @@ class Dewar(Base):
|
||||
contact_person_id = Column(Integer, ForeignKey("contact_persons.id")) # Added
|
||||
|
||||
shipment = relationship("Shipment", back_populates="dewars")
|
||||
return_address = relationship("Address") # Defines relationship with Address
|
||||
contact_person = relationship("ContactPerson") # Defines relationship with ContactPerson
|
||||
|
||||
return_address = relationship("Address")
|
||||
contact_person = relationship("ContactPerson")
|
||||
|
||||
class Proposal(Base):
|
||||
__tablename__ = "proposals"
|
||||
@ -75,4 +69,4 @@ class Proposal(Base):
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
number = Column(String)
|
||||
|
||||
shipments = relationship("Shipment", back_populates="proposal")
|
||||
shipments = relationship("Shipment", back_populates="proposal")
|
Reference in New Issue
Block a user