feat: add trusted groups functionality for duty information
- Introduced a new `trusted_groups` table to store groups authorized to receive duty information. - Implemented functions to add, remove, and check trusted groups in the database. - Enhanced command handlers to manage trusted groups, including `/trust_group` and `/untrust_group` commands for admin users. - Updated internationalization messages to support new commands and group status notifications. - Added unit tests for trusted groups repository functions to ensure correct behavior and data integrity.
This commit is contained in:
32
alembic/versions/009_trusted_groups.py
Normal file
32
alembic/versions/009_trusted_groups.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Add trusted_groups table.
|
||||
|
||||
Revision ID: 009
|
||||
Revises: 008
|
||||
Create Date: 2025-03-02
|
||||
|
||||
Table for groups authorized to receive duty information.
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision: str = "009"
|
||||
down_revision: Union[str, None] = "008"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"trusted_groups",
|
||||
sa.Column("chat_id", sa.BigInteger(), nullable=False),
|
||||
sa.Column("added_by_user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("added_at", sa.Text(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("chat_id"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("trusted_groups")
|
||||
Reference in New Issue
Block a user