Model/infrastructure/postgres/bulk_address_upload_table.py
2026-06-04 11:47:42 +00:00

29 lines
1.1 KiB
Python

from __future__ import annotations
from datetime import datetime, timezone
from typing import ClassVar, Optional
from uuid import UUID
from sqlmodel import Field, SQLModel
class BulkAddressUploadRow(SQLModel, table=True):
"""Minimal mirror of the FE-owned ``bulk_address_uploads`` table.
The schema source of truth is the Next.js Drizzle repo
(``src/app/db/schema/bulk_address_uploads.ts``); the backend's fuller mirror
lives at ``backend/app/db/models/bulk_address_uploads.py``. This DDD-side
mirror declares only the columns the finaliser writes — the terminal status —
so the finaliser can flip status on its own ``PostgresConfig`` session without
pulling in the legacy ``backend/`` connection (ADR-0013). Keep the column names
in step with the Drizzle source.
"""
__tablename__: ClassVar[str] = "bulk_address_uploads" # pyright: ignore[reportIncompatibleVariableOverride]
id: UUID = Field(primary_key=True)
task_id: Optional[UUID] = Field(default=None, index=True)
status: str
updated_at: datetime = Field(
default_factory=lambda: datetime.now(timezone.utc)
)