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:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user