Share Telegram channels across sections
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 43s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 43s
This commit is contained in:
@@ -54,12 +54,16 @@ class Section(Base):
|
||||
|
||||
class Channel(Base):
|
||||
__tablename__ = "channels"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("section_id", "identifier", name="uq_channels_section_identifier"),
|
||||
Index("ix_channels_source_channel_id", "source_channel_id"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
# Telegram numeric channel id (peer id), nullable until first resolve
|
||||
tg_id: Mapped[int | None] = mapped_column(BigInteger, unique=True, nullable=True)
|
||||
# Username or t.me/joinchat link supplied by user
|
||||
identifier: Mapped[str] = mapped_column(String(255), unique=True)
|
||||
identifier: Mapped[str] = mapped_column(String(255))
|
||||
title: Mapped[str | None] = mapped_column(String(512), nullable=True)
|
||||
# 'real_estate' or 'hr' — picks which LLM prompt and lead schema is used
|
||||
vertical: Mapped[str] = mapped_column(
|
||||
@@ -68,6 +72,9 @@ class Channel(Base):
|
||||
section_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("sections.id", ondelete="RESTRICT"), index=True
|
||||
)
|
||||
source_channel_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("channels.id", ondelete="SET NULL"), nullable=True
|
||||
)
|
||||
is_active: Mapped[bool] = mapped_column(default=True, server_default="true")
|
||||
last_message_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True)
|
||||
last_polled_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user