Implement FastAPI Temporal MVP pipeline
This commit is contained in:
38
app/infra/db/models/order.py
Normal file
38
app/infra/db/models/order.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Order ORM model."""
|
||||
|
||||
from sqlalchemy import Enum, Integer
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.domain.enums import CustomerLevel, OrderStatus, ServiceMode
|
||||
from app.infra.db.base import Base, TimestampMixin
|
||||
|
||||
|
||||
class OrderORM(TimestampMixin, Base):
|
||||
"""Persisted order record."""
|
||||
|
||||
__tablename__ = "orders"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
customer_level: Mapped[CustomerLevel] = mapped_column(
|
||||
Enum(CustomerLevel, native_enum=False),
|
||||
nullable=False,
|
||||
)
|
||||
service_mode: Mapped[ServiceMode] = mapped_column(
|
||||
Enum(ServiceMode, native_enum=False),
|
||||
nullable=False,
|
||||
)
|
||||
status: Mapped[OrderStatus] = mapped_column(
|
||||
Enum(OrderStatus, native_enum=False),
|
||||
nullable=False,
|
||||
default=OrderStatus.CREATED,
|
||||
)
|
||||
model_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
pose_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
garment_asset_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
scene_ref_asset_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
final_asset_id: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
|
||||
assets = relationship("AssetORM", back_populates="order", lazy="selectin")
|
||||
review_tasks = relationship("ReviewTaskORM", back_populates="order", lazy="selectin")
|
||||
workflow_runs = relationship("WorkflowRunORM", back_populates="order", lazy="selectin")
|
||||
|
||||
Reference in New Issue
Block a user