Phase 1-3 of decoupling: - path_setup.py adds project root to sys.path - Cart-owned models in cart/models/ (order, page_config) - All imports updated: shared.infrastructure, shared.db, shared.browser, etc. - PageConfig uses container_type/container_id instead of post_id FK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import Integer, String, Text, DateTime, func, JSON, text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from shared.db.base import Base
|
|
|
|
|
|
class PageConfig(Base):
|
|
__tablename__ = "page_configs"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
|
|
container_type: Mapped[str] = mapped_column(
|
|
String(32), nullable=False, server_default=text("'page'"),
|
|
)
|
|
container_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
|
|
|
features: Mapped[dict] = mapped_column(
|
|
JSON, nullable=False, server_default="{}"
|
|
)
|
|
|
|
# Per-page SumUp credentials (NULL until configured)
|
|
sumup_merchant_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
|
|
sumup_api_key: Mapped[Optional[str]] = mapped_column(Text(), nullable=True)
|
|
sumup_checkout_prefix: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
|
|
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False, server_default=func.now()
|
|
)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False, server_default=func.now()
|
|
)
|
|
deleted_at: Mapped[Optional[datetime]] = mapped_column(
|
|
DateTime(timezone=True), nullable=True
|
|
)
|