23 lines
1.3 KiB
Python
23 lines
1.3 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, Integer, String, Text, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.database import Base
|
|
|
|
|
|
class LexwareSyncRecord(Base):
|
|
__tablename__ = "lexware_sync_records"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
entity_type: Mapped[str] = mapped_column(String(80), index=True)
|
|
entity_id: Mapped[int] = mapped_column(Integer, index=True)
|
|
lexware_resource_type: Mapped[str] = mapped_column(String(80), index=True)
|
|
lexware_resource_id: Mapped[str | None] = mapped_column(String(120), nullable=True, index=True)
|
|
status: Mapped[str] = mapped_column(String(40), default="pending", server_default="pending", index=True)
|
|
direction: Mapped[str] = mapped_column(String(40), default="push", server_default="push", index=True)
|
|
payload_summary: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
error_message: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
|
synced_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|