refactor: refactor api project with ruff

This commit is contained in:
2025-06-09 12:12:48 +05:00
parent 2e4e9d1113
commit 787dc0e8f8
15 changed files with 100 additions and 112 deletions

View File

@@ -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]: