Scope monitoring TG by department

This commit is contained in:
Grendgi
2026-06-04 15:31:10 +03:00
parent f9e072774c
commit b78d1eac02
27 changed files with 481 additions and 553 deletions

View File

@@ -29,17 +29,22 @@ class Section(Base):
__tablename__ = "sections"
__table_args__ = (
UniqueConstraint("vertical", "slug", name="uq_section_vertical_slug"),
Index("ix_sections_vertical", "vertical"),
UniqueConstraint(
"vertical",
"department_id",
"slug",
name="uq_section_vertical_department_slug",
),
Index("ix_sections_vertical_department", "vertical", "department_id"),
)
id: Mapped[int] = mapped_column(primary_key=True)
vertical: Mapped[str] = mapped_column(String(32))
department_id: Mapped[str | None] = mapped_column(String(64), nullable=True)
slug: Mapped[str] = mapped_column(String(64))
title: Mapped[str] = mapped_column(String(255))
emoji: Mapped[str | None] = mapped_column(String(8), nullable=True)
description: Mapped[str | None] = mapped_column(Text, nullable=True)
access_code: Mapped[str | None] = mapped_column(String(255), nullable=True)
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), server_default=func.now()
)
@@ -112,7 +117,7 @@ class AppSetting(Base):
__tablename__ = "app_settings"
key: Mapped[str] = mapped_column(String(128), primary_key=True)
key: Mapped[str] = mapped_column(String(255), primary_key=True)
value: Mapped[dict | str | int | bool | None] = mapped_column(JSONB, nullable=False)
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), server_default=func.now()