fix: model, name
This commit is contained in:
@@ -13,9 +13,9 @@ from api.schemas.account.account import User
|
||||
from api.schemas.endpoints.account import AllUserResponse, all_user_adapter
|
||||
|
||||
|
||||
async def get_all_users_login_and_id(connection: AsyncConnection, page, limit) -> Optional[User]:
|
||||
async def get_user_accaunt_page(connection: AsyncConnection, page, limit) -> Optional[User]:
|
||||
"""
|
||||
Получает id и login всех юзеров
|
||||
Получает список ползовелей заданных значениями page, limit.
|
||||
"""
|
||||
|
||||
first_user = page*limit-(limit)
|
||||
@@ -39,22 +39,11 @@ async def get_all_users_login_and_id(connection: AsyncConnection, page, limit) -
|
||||
result = await connection.execute(query)
|
||||
count_result = await connection.execute(count_query)
|
||||
|
||||
users_data = result.fetchall()
|
||||
users_data = result.mappings().all()
|
||||
total_count = count_result.scalar()
|
||||
total_pages = math.ceil(total_count / limit)
|
||||
|
||||
|
||||
print(users_data)
|
||||
validated_users = all_user_adapter.validate_python(
|
||||
[{"id": u.id,
|
||||
"name": u.name,
|
||||
"login": u.login,
|
||||
"email": u.email,
|
||||
"bind_tenant_id": u.bind_tenant_id,
|
||||
"role": u.role.name,
|
||||
"created_at": u.created_at,
|
||||
"status": u.status.name} for u in users_data]
|
||||
)
|
||||
validated_users = all_user_adapter.validate_python(users_data)
|
||||
|
||||
return AllUserResponse(
|
||||
users=validated_users,
|
||||
|
Reference in New Issue
Block a user