admins-roles-fix
All checks were successful
Deploy on push / deploy (push) Successful in 6s

This commit is contained in:
Untone 2025-06-28 13:59:58 +03:00
parent 52bf78320b
commit da951ed14e

View File

@ -95,7 +95,7 @@ async def admin_get_users(
@query.field("adminGetRoles") @query.field("adminGetRoles")
@admin_auth_required @admin_auth_required
async def admin_get_roles(_: None, info: GraphQLResolveInfo) -> dict[str, Any]: async def admin_get_roles(_: None, info: GraphQLResolveInfo) -> list[dict[str, Any]]:
""" """
Получает список всех ролей в системе Получает список всех ролей в системе
@ -111,7 +111,7 @@ async def admin_get_roles(_: None, info: GraphQLResolveInfo) -> dict[str, Any]:
roles = session.query(Role).options(joinedload(Role.permissions)).all() roles = session.query(Role).options(joinedload(Role.permissions)).all()
# Преобразуем их в формат для API # Преобразуем их в формат для API
roles_list = [ return [
{ {
"id": role.id, "id": role.id,
"name": role.name, "name": role.name,
@ -122,8 +122,6 @@ async def admin_get_roles(_: None, info: GraphQLResolveInfo) -> dict[str, Any]:
for role in roles for role in roles
] ]
return {"roles": roles_list}
except Exception as e: except Exception as e:
logger.error(f"Ошибка при получении списка ролей: {e!s}") logger.error(f"Ошибка при получении списка ролей: {e!s}")
msg = f"Не удалось получить список ролей: {e!s}" msg = f"Не удалось получить список ролей: {e!s}"