Started with area page
This commit is contained in:
@@ -55,6 +55,15 @@ class Area(Base):
|
||||
description: Mapped[str] = mapped_column(nullable=True)
|
||||
image_path: Mapped[str] = mapped_column(nullable=True)
|
||||
|
||||
products: Mapped[list["Product"]] = relationship("Product")
|
||||
|
||||
|
||||
UnitsOfMeasure = typing.Literal[
|
||||
"g",
|
||||
"kg",
|
||||
"piece",
|
||||
]
|
||||
|
||||
|
||||
class Product(Base):
|
||||
__tablename__ = TABLE_PREFIX + "product"
|
||||
@@ -62,11 +71,14 @@ class Product(Base):
|
||||
name: Mapped[str] = mapped_column(nullable=False, unique=True)
|
||||
|
||||
price: Mapped[decimal.Decimal] = mapped_column(Numeric(10, 2))
|
||||
unit_of_measure: Mapped[UnitsOfMeasure] = mapped_column(nullable=False)
|
||||
# TODO: limit this to actually used vat rates?
|
||||
vat_rate: Mapped[decimal.Decimal] = mapped_column(Numeric(10, 2))
|
||||
|
||||
area_id: Mapped[int] = mapped_column(ForeignKey(TABLE_PREFIX + "area.id"))
|
||||
area: Mapped["Area"] = relationship("Area")
|
||||
area: Mapped["Area"] = relationship("Area", back_populates="products")
|
||||
|
||||
image_path: Mapped[str] = mapped_column(nullable=True)
|
||||
|
||||
|
||||
TransactionTypes = typing.Literal[
|
||||
|
||||
Reference in New Issue
Block a user