feat: 实现单卡资产分配与回收功能
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m45s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m45s
- 新增单卡分配/回收 API(支持 ICCID 列表、号段范围、筛选条件三种选卡方式) - 新增资产分配记录查询 API(支持多条件筛选和分页) - 新增 AssetAllocationRecord 模型、Store、Service、Handler 完整实现 - 扩展 IotCardStore 新增批量更新、号段查询、筛选查询等方法 - 修复 GORM Callback 处理 slice 类型(BatchCreate)的问题 - 新增完整的单元测试和集成测试 - 同步 OpenSpec 规范并归档 change
This commit is contained in:
@@ -55,6 +55,9 @@ func RegisterAdminRoutes(router fiber.Router, handlers *bootstrap.Handlers, midd
|
||||
if handlers.IotCard != nil {
|
||||
registerIotCardRoutes(authGroup, handlers.IotCard, handlers.IotCardImport, doc, basePath)
|
||||
}
|
||||
if handlers.AssetAllocationRecord != nil {
|
||||
registerAssetAllocationRecordRoutes(authGroup, handlers.AssetAllocationRecord, doc, basePath)
|
||||
}
|
||||
}
|
||||
|
||||
func registerAdminAuthRoutes(router fiber.Router, handler interface{}, authMiddleware fiber.Handler, doc *openapi.Generator, basePath string) {
|
||||
|
||||
30
internal/routes/asset_allocation_record.go
Normal file
30
internal/routes/asset_allocation_record.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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 registerAssetAllocationRecordRoutes(router fiber.Router, handler *admin.AssetAllocationRecordHandler, doc *openapi.Generator, basePath string) {
|
||||
records := router.Group("/asset-allocation-records")
|
||||
groupPath := basePath + "/asset-allocation-records"
|
||||
|
||||
Register(records, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
||||
Summary: "分配记录列表",
|
||||
Tags: []string{"资产分配记录"},
|
||||
Input: new(dto.ListAssetAllocationRecordRequest),
|
||||
Output: new(dto.ListAssetAllocationRecordResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(records, doc, groupPath, "GET", "/:id", handler.GetByID, RouteSpec{
|
||||
Summary: "分配记录详情",
|
||||
Tags: []string{"资产分配记录"},
|
||||
Input: new(dto.GetAssetAllocationRecordRequest),
|
||||
Output: new(dto.AssetAllocationRecordDetailResponse),
|
||||
Auth: true,
|
||||
})
|
||||
}
|
||||
@@ -43,4 +43,20 @@ func registerIotCardRoutes(router fiber.Router, handler *admin.IotCardHandler, i
|
||||
Output: new(dto.ImportTaskDetailResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(iotCards, doc, groupPath, "POST", "/standalone/allocate", handler.AllocateCards, RouteSpec{
|
||||
Summary: "批量分配单卡",
|
||||
Tags: []string{"IoT卡管理"},
|
||||
Input: new(dto.AllocateStandaloneCardsRequest),
|
||||
Output: new(dto.AllocateStandaloneCardsResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(iotCards, doc, groupPath, "POST", "/standalone/recall", handler.RecallCards, RouteSpec{
|
||||
Summary: "批量回收单卡",
|
||||
Tags: []string{"IoT卡管理"},
|
||||
Input: new(dto.RecallStandaloneCardsRequest),
|
||||
Output: new(dto.RecallStandaloneCardsResponse),
|
||||
Auth: true,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user