feat(moderation): add chat bans list endpoint with admin access checks
Some checks are pending
CI / test (push) Has started running
Some checks are pending
CI / test (push) Has started running
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user