import uuid from datetime import datetime from sqlalchemy import BigInteger, DateTime, String, func from sqlalchemy.orm import Mapped, mapped_column from app.core.database import Base class ExportRecord(Base): __tablename__ = "export_records" id: Mapped[str] = mapped_column( String(64), primary_key=True, default=lambda: f"rec-{uuid.uuid4().hex[:12]}", ) user_id: Mapped[str] = mapped_column(String(128), nullable=False, index=True) file_name: Mapped[str] = mapped_column(String(512), nullable=False) file_path: Mapped[str] = mapped_column(String(1024), nullable=False) file_size: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0) download_url: Mapped[str] = mapped_column(String(1024), nullable=False) document_id: Mapped[str | None] = mapped_column(String(64), nullable=True) style_id: Mapped[str] = mapped_column(String(64), nullable=False, default="default") created_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), server_default=func.now(), nullable=False )