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" ) // registerPollingConfigRoutes 注册轮询配置管理路由 func registerPollingConfigRoutes(router fiber.Router, handler *admin.PollingConfigHandler, doc *openapi.Generator, basePath string) { configs := router.Group("/polling-configs") groupPath := basePath + "/polling-configs" Register(configs, doc, groupPath, "GET", "", handler.List, RouteSpec{ Summary: "获取轮询配置列表", Tags: []string{"轮询配置管理"}, Input: new(dto.PollingConfigListRequest), Output: new(dto.PollingConfigPageResult), Auth: true, }) Register(configs, doc, groupPath, "POST", "", handler.Create, RouteSpec{ Summary: "创建轮询配置", Tags: []string{"轮询配置管理"}, Input: new(dto.CreatePollingConfigRequest), Output: new(dto.PollingConfigResponse), Auth: true, }) Register(configs, doc, groupPath, "GET", "/enabled", handler.ListEnabled, RouteSpec{ Summary: "获取所有启用的配置", Tags: []string{"轮询配置管理"}, Input: nil, Output: []dto.PollingConfigResponse{}, Auth: true, }) Register(configs, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{ Summary: "获取轮询配置详情", Tags: []string{"轮询配置管理"}, Input: new(dto.IDReq), Output: new(dto.PollingConfigResponse), Auth: true, }) Register(configs, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{ Summary: "更新轮询配置", Tags: []string{"轮询配置管理"}, Input: new(dto.UpdatePollingConfigParams), Output: new(dto.PollingConfigResponse), Auth: true, }) Register(configs, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{ Summary: "删除轮询配置", Tags: []string{"轮询配置管理"}, Input: new(dto.IDReq), Output: nil, Auth: true, }) Register(configs, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{ Summary: "更新轮询配置状态", Tags: []string{"轮询配置管理"}, Input: new(dto.UpdatePollingConfigStatusParams), Output: nil, Auth: true, }) }