update role

This commit is contained in:
2026-03-30 10:12:24 +08:00
parent 6cfb2371e7
commit 9502fa220a
@@ -38,7 +38,7 @@ class RoleController extends AbstractController
#[OA\Get(
path: '/roles',
summary: '角色列表',
description: '获取所有角色,包含每个角色的用户数',
description: '获取所有角色,包含每个角色的用户数和路由组数',
security: [['bearerAuth' => []]],
tags: ['Roles'],
responses: [
@@ -52,7 +52,10 @@ class RoleController extends AbstractController
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string', example: 'editor'),
new OA\Property(property: 'label', type: 'string', example: '编辑者'),
new OA\Property(property: 'description', type: 'string', example: '可以编辑内容'),
new OA\Property(property: 'users_count', type: 'integer', example: 5),
new OA\Property(property: 'route_groups_count', type: 'integer', example: 3),
],
type: 'object'
)),
@@ -67,7 +70,7 @@ class RoleController extends AbstractController
public function index(): array
{
$roles = Role::query()
->withCount('users')
->withCount(['users', 'routeGroups'])
->orderBy('id')
->get();