All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m22s
- 新增 PermissionTreeRequest DTO 支持 status 查询参数 - PermissionTreeNode 返回值新增 status 字段 - Store 层 GetAll 方法支持状态过滤 - Handler 层使用 QueryParser 解析请求参数
65 lines
1.8 KiB
Go
65 lines
1.8 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
|
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
// registerPermissionRoutes 注册权限相关路由
|
|
func registerPermissionRoutes(api fiber.Router, h *admin.PermissionHandler, doc *openapi.Generator, basePath string) {
|
|
permissions := api.Group("/permissions")
|
|
groupPath := basePath + "/permissions"
|
|
|
|
// 权限 CRUD
|
|
Register(permissions, doc, groupPath, "POST", "", h.Create, RouteSpec{
|
|
Summary: "创建权限",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.CreatePermissionRequest),
|
|
Output: new(dto.PermissionResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(permissions, doc, groupPath, "GET", "", h.List, RouteSpec{
|
|
Summary: "权限列表",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.PermissionListRequest),
|
|
Output: new(dto.PermissionPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(permissions, doc, groupPath, "GET", "/tree", h.GetTree, RouteSpec{
|
|
Summary: "获取权限树",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.PermissionTreeRequest),
|
|
Output: new([]*dto.PermissionTreeNode),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(permissions, doc, groupPath, "GET", "/:id", h.Get, RouteSpec{
|
|
Summary: "获取权限详情",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.PermissionResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(permissions, doc, groupPath, "PUT", "/:id", h.Update, RouteSpec{
|
|
Summary: "更新权限",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.UpdatePermissionParams),
|
|
Output: new(dto.PermissionResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(permissions, doc, groupPath, "DELETE", "/:id", h.Delete, RouteSpec{
|
|
Summary: "删除权限",
|
|
Tags: []string{"权限"},
|
|
Input: new(dto.IDReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|