feat: pallets and boxes for deals

This commit is contained in:
2024-12-09 16:45:10 +04:00
parent d56e292276
commit 863dd226c3
14 changed files with 631 additions and 44 deletions

View File

@@ -7,6 +7,7 @@ from sqlalchemy.orm import relationship, backref, Mapped, mapped_column
from models.base import BaseModel
from .marketplace import BaseMarketplace
from .shipping import Pallet, Box
from .shipping_warehouse import ShippingWarehouse
if TYPE_CHECKING:
@@ -104,6 +105,9 @@ class Deal(BaseModel):
manager_id: Mapped[int] = mapped_column(ForeignKey('users.id'), nullable=True)
manager: Mapped[Optional["User"]] = relationship(back_populates='managed_deals', lazy='joined')
pallets: Mapped[list[Pallet]] = relationship(back_populates='deal', lazy='selectin')
boxes: Mapped[list[Box]] = relationship(back_populates='deal', lazy='selectin')
class DealStatusHistory(BaseModel):
__tablename__ = 'deals_status_history'