refactor(B1): migrate to domain-driven project structure
Move all models/schemas/services/routers into app/domains/. Keep backward-compat shims in old locations for imports. Preserves domains/rendering/tasks.py from Phase A. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,52 +1,3 @@
|
||||
import uuid
|
||||
import enum
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from sqlalchemy import String, DateTime, Text, ForeignKey, Numeric
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy.dialects.postgresql import UUID, JSONB
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class OrderLine(Base):
|
||||
__tablename__ = "order_lines"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
order_id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("orders.id", ondelete="CASCADE"), nullable=False, index=True
|
||||
)
|
||||
product_id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("products.id"), nullable=False, index=True
|
||||
)
|
||||
output_type_id: Mapped[uuid.UUID | None] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("output_types.id"), nullable=True
|
||||
)
|
||||
gewuenschte_bildnummer: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
item_status: Mapped[str] = mapped_column(String(20), nullable=False, default="pending")
|
||||
render_status: Mapped[str] = mapped_column(String(20), nullable=False, default="pending")
|
||||
result_path: Mapped[str | None] = mapped_column(String(1000), nullable=True)
|
||||
render_log: Mapped[dict | None] = mapped_column(JSONB, nullable=True)
|
||||
ai_validation_status: Mapped[str] = mapped_column(String(20), nullable=False, default="not_started")
|
||||
ai_validation_result: Mapped[dict | None] = mapped_column(JSONB, nullable=True)
|
||||
flamenco_job_id: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
||||
render_backend_used: Mapped[str | None] = mapped_column(String(20), nullable=True)
|
||||
render_started_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
render_completed_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
unit_price: Mapped[Decimal | None] = mapped_column(Numeric(10, 2), nullable=True)
|
||||
render_position_id: Mapped[uuid.UUID | None] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("product_render_positions.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
notes: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
||||
)
|
||||
|
||||
order: Mapped["Order"] = relationship("Order", back_populates="lines")
|
||||
product: Mapped["Product"] = relationship("Product", back_populates="order_lines")
|
||||
output_type: Mapped["OutputType | None"] = relationship("OutputType", back_populates="order_lines")
|
||||
render_position: Mapped["ProductRenderPosition | None"] = relationship(
|
||||
"ProductRenderPosition", back_populates="order_lines"
|
||||
)
|
||||
# Compat shim — use app.domains.orders.models instead
|
||||
from app.domains.orders.models import OrderLine
|
||||
__all__ = ["OrderLine"]
|
||||
|
||||
Reference in New Issue
Block a user