feat(estimates): integrate inventory items
This commit is contained in:
parent
fb5c2cc26a
commit
663bdc41b1
15 changed files with 629 additions and 28 deletions
|
|
@ -52,6 +52,11 @@ class RepairEstimateItem(Base):
|
|||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
estimate_id: Mapped[int] = mapped_column(ForeignKey("repair_estimates.id", ondelete="CASCADE"), index=True)
|
||||
inventory_item_id: Mapped[int | None] = mapped_column(ForeignKey("inventory_items.id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
inventory_snapshot_name: Mapped[str] = mapped_column(String(255), default="", server_default="")
|
||||
inventory_snapshot_sku: Mapped[str] = mapped_column(String(40), default="", server_default="")
|
||||
inventory_snapshot_manufacturer: Mapped[str | None] = mapped_column(String(180), nullable=True)
|
||||
inventory_snapshot_part_number: Mapped[str | None] = mapped_column(String(180), nullable=True)
|
||||
position: Mapped[int] = mapped_column(Integer)
|
||||
item_type: Mapped[str] = mapped_column(String(40), index=True)
|
||||
title: Mapped[str] = mapped_column(String(255))
|
||||
|
|
@ -64,6 +69,7 @@ class RepairEstimateItem(Base):
|
|||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
|
||||
estimate: Mapped[RepairEstimate] = relationship(back_populates="items")
|
||||
inventory_item = relationship("InventoryItem", lazy="joined")
|
||||
|
||||
|
||||
class RepairEstimateEvent(Base):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue