From 9502fa220a2813edd0a5fb831544819f1759dd01 Mon Sep 17 00:00:00 2001 From: Nick Zeng Date: Mon, 30 Mar 2026 10:12:24 +0800 Subject: [PATCH] update role --- backend/app/Controller/api/v1/RoleController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/Controller/api/v1/RoleController.php b/backend/app/Controller/api/v1/RoleController.php index 597176a..84be5fe 100644 --- a/backend/app/Controller/api/v1/RoleController.php +++ b/backend/app/Controller/api/v1/RoleController.php @@ -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();