All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m16s
主要变更: - 新增 Carrier CRUD API(创建、列表、详情、更新、删除、状态更新) - IotCard/IotCardImportTask 添加 carrier_type/carrier_name 冗余字段 - 移除 Carrier 表的 channel_name/channel_code 字段 - 查询时直接使用冗余字段,避免 JOIN Carrier 表 - 添加数据库迁移脚本(000021-000023) - 添加单元测试和集成测试 - 同步更新 OpenAPI 文档和 specs
63 lines
1.8 KiB
Go
63 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"
|
|
)
|
|
|
|
func registerCarrierRoutes(router fiber.Router, handler *admin.CarrierHandler, doc *openapi.Generator, basePath string) {
|
|
carriers := router.Group("/carriers")
|
|
groupPath := basePath + "/carriers"
|
|
|
|
Register(carriers, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "运营商列表",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.CarrierListRequest),
|
|
Output: new(dto.CarrierPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(carriers, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建运营商",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.CreateCarrierRequest),
|
|
Output: new(dto.CarrierResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(carriers, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
|
|
Summary: "获取运营商详情",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.CarrierResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(carriers, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新运营商",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.UpdateCarrierParams),
|
|
Output: new(dto.CarrierResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(carriers, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
|
|
Summary: "删除运营商",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.IDReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(carriers, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
|
|
Summary: "更新运营商状态",
|
|
Tags: []string{"运营商管理"},
|
|
Input: new(dto.UpdateCarrierStatusParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|