Skip to content

Commit

Permalink
/get active status & new filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoom-Developer committed Nov 19, 2024
1 parent 42102a5 commit 80beb85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions backend/src/interface/rabbit/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def user(data: UserRequest) -> RabbitRequestResponse[GetUserResponse]:
return RabbitRequestResponse(
response = GetUserResponse(
text =
f"<b>Имя:</b> {user.mention} <b>(<code>{user.id}</code>)</b>"
f"<b>Имя:</b> {user.mention} <b>(<code>{user.id}</code>)</b> {'[НЕАКТИВЕН]' if not user.is_active else ''}"
f"\n<b>Класс:</b> {user.literal}"
f"\n<b>Пол:</b> {'Мужской' if user.male else 'Женский'}"
f"\n<b>Описание:</b> <i>{user.desc}</i>"
Expand All @@ -64,7 +64,10 @@ async def users(data: GetUsers) -> RabbitRequestResponse[GetUserResponse]:
filters = {
"all": True,
"banned": User.is_banned,
"verify": User.verify
"verify": User.verify,
"male": User.male,
"female": not User.male,
"inactive": not User.is_active
}
users = await UserRepository().get_all(data.offset, data.limit, filters[data.filter])
total = await UserRepository().count(filters[data.filter])
Expand Down
4 changes: 2 additions & 2 deletions bot/src/interface/telegram/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ async def user(
)

@handler.message(Command("users"), F.chat.id == TG_ADMIN_CHAT)
async def user(
async def users(
msg: Message,
state: FSMContext,
data: GetUsersArgs = Data(["filter"],"❕ Use: /users [FILTER: all, verify, banned]*" )
data: GetUsersArgs = Data(["filter"],"❕ Use: /users [FILTER: all, verify, banned, male, female, inactive]*" )
):
res = await get_users(0, USERS_LIST_LIMIT, data.filter)
if not res.success:
Expand Down
2 changes: 1 addition & 1 deletion bot/src/models/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class GetUsersArgs(BaseModel):
filter: Literal["all", "banned", "verify"] = "all"
filter: Literal["all", "banned", "verify", "male", "female", "inactive"] = "all"

class GetUsers(GetUsersArgs):
offset: int = 0
Expand Down

0 comments on commit 80beb85

Please sign in to comment.