Implement display artifacts, pricing integrity, draft base and publish preview bundle

This commit is contained in:
greebo
2026-03-19 17:58:17 +03:00
parent 85fb2f4bb9
commit c91c5abf15
35 changed files with 3283 additions and 302 deletions

View File

@@ -0,0 +1,36 @@
from datetime import datetime
from decimal import Decimal
from sqlalchemy import BigInteger, DateTime, Numeric, String, func
from sqlalchemy.orm import Mapped, mapped_column
from app.db.base import Base
class SchemeVersionPricingCategoryRecord(Base):
__tablename__ = "scheme_version_pricing_categories"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
snapshot_category_id: Mapped[str] = mapped_column(String(32), unique=True, index=True, nullable=False)
scheme_id: Mapped[str] = mapped_column(String(32), nullable=False)
scheme_version_id: Mapped[str] = mapped_column(String(32), index=True, nullable=False)
source_pricing_category_id: Mapped[str | None] = mapped_column(String(32), nullable=True)
name: Mapped[str] = mapped_column(String(255), nullable=False)
code: Mapped[str | None] = mapped_column(String(128), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=func.now())
class SchemeVersionPriceRuleRecord(Base):
__tablename__ = "scheme_version_price_rules"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
snapshot_price_rule_id: Mapped[str] = mapped_column(String(32), unique=True, index=True, nullable=False)
scheme_id: Mapped[str] = mapped_column(String(32), nullable=False)
scheme_version_id: Mapped[str] = mapped_column(String(32), index=True, nullable=False)
source_price_rule_id: Mapped[str | None] = mapped_column(String(32), nullable=True)
snapshot_category_id: Mapped[str | None] = mapped_column(String(32), nullable=True)
target_type: Mapped[str] = mapped_column(String(32), nullable=False)
target_ref: Mapped[str] = mapped_column(String(128), nullable=False)
amount: Mapped[Decimal] = mapped_column(Numeric(12, 2), nullable=False)
currency: Mapped[str] = mapped_column(String(8), nullable=False)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=func.now())