feat(role): 新增平台角色管理功能增强

- 权限表增加 available_for_role_types 字段,支持标记权限可用角色类型
- 权限列表和权限树接口支持按 available_for_role_type 过滤
- 新增角色状态切换接口 PUT /api/admin/roles/:id/status
- 角色分配权限时验证权限的可用角色类型
- 完善数据库迁移脚本和单元测试
- 补充数据库迁移相关开发规范文档
This commit is contained in:
2026-01-14 12:15:57 +08:00
parent 9c399df6bc
commit 5556b1028c
22 changed files with 1474 additions and 87 deletions

View File

@@ -42,6 +42,13 @@ func registerRoleRoutes(api fiber.Router, h *admin.RoleHandler, doc *openapi.Gen
Output: new(model.RoleResponse),
})
Register(roles, doc, groupPath, "PUT", "/:id/status", h.UpdateStatus, RouteSpec{
Summary: "更新角色状态",
Tags: []string{"Role"},
Input: new(model.UpdateRoleStatusParams),
Output: nil,
})
Register(roles, doc, groupPath, "DELETE", "/:id", h.Delete, RouteSpec{
Summary: "删除角色",
Tags: []string{"Role"},