Started with area page

This commit is contained in:
2025-10-29 10:31:09 +01:00
parent bd2f7b286e
commit b3166811e5
7 changed files with 78 additions and 3 deletions

View File

@@ -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[