from datetime import datetime from sqlalchemy import BigInteger, Boolean, DateTime, String from sqlalchemy.orm import Mapped, mapped_column from .base import Base class ManagedChat(Base): __tablename__ = "managed_chats" id: Mapped[int] = mapped_column(BigInteger, primary_key=True) # Telegram chat_id title: Mapped[str] = mapped_column(String(255)) username: Mapped[str | None] = mapped_column(String(255), nullable=True) chat_type: Mapped[str] = mapped_column(String(50)) # group, supergroup, channel invite_link: Mapped[str | None] = mapped_column(String(512), nullable=True) last_message_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True) is_active: Mapped[bool] = mapped_column(Boolean, default=True) added_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)