All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m39s
- 新增企业设备授权模块(Model、DTO、Service、Handler、Store) - 实现设备授权的创建、查询、更新、删除等完整业务逻辑 - 添加企业卡授权与设备授权的关联关系 - 新增 2 个数据库迁移脚本 - 同步 OpenSpec delta specs 到 main specs - 归档 add-enterprise-device-authorization 变更 - 更新 API 文档和路由配置 - 新增完整的集成测试和单元测试覆盖
39 lines
1.3 KiB
Go
39 lines
1.3 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"
|
|
)
|
|
|
|
func registerEnterpriseDeviceRoutes(router fiber.Router, handler *admin.EnterpriseDeviceHandler, doc *openapi.Generator, basePath string) {
|
|
enterprises := router.Group("/enterprises")
|
|
groupPath := basePath + "/enterprises"
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/allocate-devices", handler.AllocateDevices, RouteSpec{
|
|
Summary: "授权设备给企业",
|
|
Tags: []string{"企业设备授权"},
|
|
Input: new(dto.AllocateDevicesReq),
|
|
Output: new(dto.AllocateDevicesResp),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/recall-devices", handler.RecallDevices, RouteSpec{
|
|
Summary: "撤销设备授权",
|
|
Tags: []string{"企业设备授权"},
|
|
Input: new(dto.RecallDevicesReq),
|
|
Output: new(dto.RecallDevicesResp),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "GET", "/:id/devices", handler.ListDevices, RouteSpec{
|
|
Summary: "企业设备列表",
|
|
Tags: []string{"企业设备授权"},
|
|
Input: new(dto.EnterpriseDeviceListReq),
|
|
Output: new(dto.EnterpriseDeviceListResp),
|
|
Auth: true,
|
|
})
|
|
}
|