This commit is contained in:
2026-07-09 16:45:17 +03:00
parent 5c7a9710f3
commit da24ed8ba7
23 changed files with 1542 additions and 358 deletions

View File

@@ -266,6 +266,42 @@ class SubscriptionNotification(Base):
sent_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow)
class BroadcastPoll(Base):
__tablename__ = "broadcast_polls"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
question_text: Mapped[str] = mapped_column(Text, nullable=False)
created_by_telegram_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True, index=True)
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow)
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow, onupdate=utcnow)
class BroadcastPollAnswer(Base):
__tablename__ = "broadcast_poll_answers"
__table_args__ = (
Index(
"ix_broadcast_poll_answers_unique_user",
"poll_id",
"telegram_id",
unique=True,
),
)
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
poll_id: Mapped[int] = mapped_column(
ForeignKey("broadcast_polls.id", ondelete="CASCADE"),
nullable=False,
index=True,
)
telegram_id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True)
username: Mapped[str | None] = mapped_column(String(64), nullable=True)
first_name: Mapped[str | None] = mapped_column(String(255), nullable=True)
last_name: Mapped[str | None] = mapped_column(String(255), nullable=True)
answer: Mapped[str] = mapped_column(String(8), nullable=False)
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow)
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=utcnow, onupdate=utcnow)
class PaymentOrder(Base):
__tablename__ = "payment_orders"