feat: cards, attributes and modules
This commit is contained in:
@@ -5,15 +5,15 @@ from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from models import BaseModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from models import Deal, Product, Client
|
||||
from models import Card, Product, Client
|
||||
|
||||
|
||||
class Pallet(BaseModel):
|
||||
__tablename__ = 'pallets'
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
|
||||
deal_id: Mapped[int] = mapped_column(ForeignKey('deals.id'))
|
||||
deal: Mapped['Deal'] = relationship(back_populates='pallets')
|
||||
card_id: Mapped[int] = mapped_column(ForeignKey('cards.id'))
|
||||
card: Mapped['Card'] = relationship(back_populates='pallets')
|
||||
|
||||
boxes: Mapped[list['Box']] = relationship(
|
||||
back_populates='pallet',
|
||||
@@ -54,5 +54,5 @@ class Box(BaseModel):
|
||||
pallet_id: Mapped[Optional[int]] = mapped_column(ForeignKey('pallets.id'))
|
||||
pallet: Mapped[Pallet] = relationship(back_populates='boxes')
|
||||
|
||||
deal_id: Mapped[Optional[int]] = mapped_column(ForeignKey('deals.id'))
|
||||
deal: Mapped['Deal'] = relationship(back_populates='boxes')
|
||||
card_id: Mapped[Optional[int]] = mapped_column(ForeignKey('cards.id'))
|
||||
card: Mapped['Card'] = relationship(back_populates='boxes')
|
||||
|
||||
Reference in New Issue
Block a user