Implement user subscription deletion and banned users management

- Replaced the trial reset functionality to delete all user subscriptions instead of deactivating them, ensuring a complete reset of trial eligibility.
- Added a new method to retrieve banned users from the database, enhancing the admin's ability to manage user bans.
- Updated user management handlers to utilize the new subscription deletion and banned users retrieval features.
- Enhanced localization files to support new messages related to banned users.
This commit is contained in:
machka-pasla
2025-08-03 17:51:37 +03:00
parent 39ba57951c
commit 0f26c9bdba
5 changed files with 128 additions and 8 deletions
+11
View File
@@ -93,6 +93,17 @@ async def set_user_ban_status(
return False
async def get_banned_users(session: AsyncSession) -> List[User]:
"""Get all banned users"""
stmt = (
select(User)
.where(User.is_banned == True)
.order_by(User.registration_date.desc())
)
result = await session.execute(stmt)
return result.scalars().all()
async def get_banned_users_paginated(
session: AsyncSession, limit: int, offset: int
) -> Tuple[List[User], int]: