refactor: refactor api project with ruff
This commit is contained in:
@@ -18,17 +18,19 @@ async def get_user_accaunt_page(connection: AsyncConnection, page, limit) -> Opt
|
||||
Получает список ползовелей заданных значениями page, limit.
|
||||
"""
|
||||
|
||||
first_user = page*limit-(limit)
|
||||
first_user = page * limit - (limit)
|
||||
|
||||
query = (
|
||||
select(account_table.c.id,
|
||||
account_table.c.name,
|
||||
account_table.c.login,
|
||||
account_table.c.email,
|
||||
account_table.c.bind_tenant_id,
|
||||
account_table.c.role,
|
||||
account_table.c.created_at,
|
||||
account_table.c.status)
|
||||
select(
|
||||
account_table.c.id,
|
||||
account_table.c.name,
|
||||
account_table.c.login,
|
||||
account_table.c.email,
|
||||
account_table.c.bind_tenant_id,
|
||||
account_table.c.role,
|
||||
account_table.c.created_at,
|
||||
account_table.c.status,
|
||||
)
|
||||
.order_by(account_table.c.id)
|
||||
.offset(first_user)
|
||||
.limit(limit)
|
||||
@@ -45,11 +47,7 @@ async def get_user_accaunt_page(connection: AsyncConnection, page, limit) -> Opt
|
||||
|
||||
validated_users = all_user_adapter.validate_python(users_data)
|
||||
|
||||
return AllUserResponse(
|
||||
users=validated_users,
|
||||
amount_count=total_count,
|
||||
amount_pages=total_pages
|
||||
)
|
||||
return AllUserResponse(users=validated_users, amount_count=total_count, amount_pages=total_pages)
|
||||
|
||||
|
||||
async def get_user_by_id(connection: AsyncConnection, id: int) -> Optional[User]:
|
||||
|
Reference in New Issue
Block a user