Files
junhong_cmp_fiber/internal/routes/enterprise_card.go
huang b9c3875c08
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m3s
feat: 新增数据库迁移,重命名 device_no 为 virtual_no,新增 iot_card.virtual_no 和 package.virtual_ratio 字段
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-14 18:27:28 +08:00

40 lines
1.2 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", 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,
})
}