feat(moderation): add chat bans list endpoint with admin access checks
Some checks are pending
CI / test (push) Has started running

This commit is contained in:
2026-03-08 21:21:43 +03:00
parent 5909503012
commit 90320ffd5d
7 changed files with 114 additions and 1 deletions

View File

@@ -434,3 +434,10 @@ async def remove_chat_ban(db: AsyncSession, *, chat_id: int, user_id: int) -> No
ban = await get_chat_ban(db, chat_id=chat_id, user_id=user_id)
if ban:
await db.delete(ban)
async def list_chat_bans(db: AsyncSession, *, chat_id: int) -> list[ChatBan]:
result = await db.execute(
select(ChatBan).where(ChatBan.chat_id == chat_id).order_by(ChatBan.created_at.desc(), ChatBan.id.desc())
)
return list(result.scalars().all())