Implement FastAPI Temporal MVP pipeline
This commit is contained in:
31
app/infra/db/models/asset.py
Normal file
31
app/infra/db/models/asset.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Asset ORM model."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import Enum, ForeignKey, Integer, JSON, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.domain.enums import AssetType, WorkflowStepName
|
||||
from app.infra.db.base import Base, TimestampMixin
|
||||
|
||||
|
||||
class AssetORM(TimestampMixin, Base):
|
||||
"""Persisted generated asset."""
|
||||
|
||||
__tablename__ = "assets"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
order_id: Mapped[int] = mapped_column(ForeignKey("orders.id"), nullable=False, index=True)
|
||||
asset_type: Mapped[AssetType] = mapped_column(
|
||||
Enum(AssetType, native_enum=False),
|
||||
nullable=False,
|
||||
)
|
||||
step_name: Mapped[WorkflowStepName | None] = mapped_column(
|
||||
Enum(WorkflowStepName, native_enum=False),
|
||||
nullable=True,
|
||||
)
|
||||
uri: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
metadata_json: Mapped[dict[str, Any] | None] = mapped_column(JSON, nullable=True)
|
||||
|
||||
order = relationship("OrderORM", back_populates="assets")
|
||||
|
||||
Reference in New Issue
Block a user