24 lines
776 B
Python
24 lines
776 B
Python
"""WhatsApp log model for mock endpoint."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, Integer, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class WhatsAppLog(Base):
|
|
__tablename__ = "whatsapp_log"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
command: Mapped[str] = mapped_column(Text, nullable=False)
|
|
from_number: Mapped[str | None] = mapped_column(String(50), nullable=True)
|
|
ticket_id: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
|
received_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<WhatsAppLog {self.id}: {self.command[:50]}>"
|