Implement FastAPI Temporal MVP pipeline

This commit is contained in:
Codex
2026-03-27 00:10:28 +08:00
commit cc03da8a94
52 changed files with 3619 additions and 0 deletions

33
app/infra/db/base.py Normal file
View File

@@ -0,0 +1,33 @@
"""Database base declarations."""
from datetime import datetime, timezone
from sqlalchemy import DateTime
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
def utc_now() -> datetime:
"""Return the current UTC timestamp."""
return datetime.now(timezone.utc)
class Base(DeclarativeBase):
"""Shared declarative base."""
class TimestampMixin:
"""Mixin that adds created and updated timestamps."""
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
default=utc_now,
nullable=False,
)
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
default=utc_now,
onupdate=utc_now,
nullable=False,
)