24 lines
1.2 KiB
Python
24 lines
1.2 KiB
Python
from datetime import datetime, date
|
|
from sqlalchemy import String, Text, DateTime, Date, Integer
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from app.db import Base
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
modality: Mapped[str] = mapped_column(String, nullable=False)
|
|
raw_content: Mapped[str] = mapped_column(Text, nullable=False)
|
|
captured_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
|
sender_id: Mapped[str | None] = mapped_column(String, nullable=True)
|
|
type: Mapped[str | None] = mapped_column(String, nullable=True)
|
|
stage: Mapped[str] = mapped_column(String, nullable=False, default="new")
|
|
direction: Mapped[str] = mapped_column(String, nullable=False, default="inbound")
|
|
notes: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
follow_up_date: Mapped[date | None] = mapped_column(Date, nullable=True)
|
|
discord_message_id: Mapped[str | None] = mapped_column(String, unique=True, nullable=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow
|
|
)
|