22 lines
854 B
Python
22 lines
854 B
Python
"""ORM model for iframe embed session → thread lookups."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
from deerflow.persistence.types import BeijingDateTime
|
|
|
|
|
|
class EmbedSessionRow(Base):
|
|
__tablename__ = "embed_sessions"
|
|
|
|
# Opaque id generated by the parent page and passed into the iframe URL.
|
|
session_id: Mapped[str] = mapped_column(String(128), primary_key=True)
|
|
thread_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
|
created_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC))
|
|
updated_at: Mapped[datetime] = mapped_column(BeijingDateTime(), nullable=False, default=lambda: datetime.now(UTC))
|