All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m22s
- 移动 17 个 DTO 文件到 internal/model/dto/ 目录 - 更新所有 DTO 文件的 package 声明从 model 改为 dto - 更新所有引用文件的 import 和类型引用 - Handler 层:admin 和 h5 所有处理器 - Service 层:所有业务服务 - Routes 层:所有路由定义 - Tests 层:单元测试和集成测试 - 清理未使用的 import 语句 - 验证:项目构建成功,测试编译通过,LSP 无错误
63 lines
2.0 KiB
Go
63 lines
2.0 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 registerEnterpriseCardRoutes(router fiber.Router, handler *admin.EnterpriseCardHandler, doc *openapi.Generator, basePath string) {
|
|
enterprises := router.Group("/enterprises")
|
|
groupPath := basePath + "/enterprises"
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/allocate-cards/preview", handler.AllocateCardsPreview, RouteSpec{
|
|
Summary: "卡授权预检",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.AllocateCardsPreviewReq),
|
|
Output: new(dto.AllocateCardsPreviewResp),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/allocate-cards", handler.AllocateCards, RouteSpec{
|
|
Summary: "授权卡给企业",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.AllocateCardsReq),
|
|
Output: new(dto.AllocateCardsResp),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/recall-cards", handler.RecallCards, RouteSpec{
|
|
Summary: "回收卡授权",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.RecallCardsReq),
|
|
Output: new(dto.RecallCardsResp),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "GET", "/:id/cards", handler.ListCards, RouteSpec{
|
|
Summary: "企业卡列表",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.EnterpriseCardListReq),
|
|
Output: new(dto.EnterpriseCardPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/cards/:card_id/suspend", handler.SuspendCard, RouteSpec{
|
|
Summary: "停机卡",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.SuspendCardReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(enterprises, doc, groupPath, "POST", "/:id/cards/:card_id/resume", handler.ResumeCard, RouteSpec{
|
|
Summary: "复机卡",
|
|
Tags: []string{"企业卡授权"},
|
|
Input: new(dto.ResumeCardReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|