Files
junhong_cmp_fiber/internal/routes/enterprise_card.go
huang 23be0a7d3e
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m17s
fix: 修复 OpenAPI 路径参数 path 标签缺失导致启动 panic 的问题
- 为 enterprise_card_authorization_dto.go 中的 DTO 添加 path 标签
- 为 customer_account_dto.go 中的 DTO 添加 path 标签并重构结构
- 为 enterprise_dto.go 中的 DTO 添加 path 标签并重构结构
- 更新 handler 和 service 层使用正确的请求体类型
2026-01-21 18:42:29 +08:00

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"
"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(model.AllocateCardsPreviewReq),
Output: new(model.AllocateCardsPreviewResp),
Auth: true,
})
Register(enterprises, doc, groupPath, "POST", "/:id/allocate-cards", handler.AllocateCards, RouteSpec{
Summary: "授权卡给企业",
Tags: []string{"企业卡授权"},
Input: new(model.AllocateCardsReq),
Output: new(model.AllocateCardsResp),
Auth: true,
})
Register(enterprises, doc, groupPath, "POST", "/:id/recall-cards", handler.RecallCards, RouteSpec{
Summary: "回收卡授权",
Tags: []string{"企业卡授权"},
Input: new(model.RecallCardsReq),
Output: new(model.RecallCardsResp),
Auth: true,
})
Register(enterprises, doc, groupPath, "GET", "/:id/cards", handler.ListCards, RouteSpec{
Summary: "企业卡列表",
Tags: []string{"企业卡授权"},
Input: new(model.EnterpriseCardListReq),
Output: new(model.EnterpriseCardPageResult),
Auth: true,
})
Register(enterprises, doc, groupPath, "POST", "/:id/cards/:card_id/suspend", handler.SuspendCard, RouteSpec{
Summary: "停机卡",
Tags: []string{"企业卡授权"},
Input: new(model.SuspendCardReq),
Output: nil,
Auth: true,
})
Register(enterprises, doc, groupPath, "POST", "/:id/cards/:card_id/resume", handler.ResumeCard, RouteSpec{
Summary: "复机卡",
Tags: []string{"企业卡授权"},
Input: new(model.ResumeCardReq),
Output: nil,
Auth: true,
})
}