All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m32s
主要改进: 1. 新增 docs/api-documentation-guide.md 详细文档指南 2. 在 AGENTS.md 中添加路由注册规范章节 3. 更新 README.md 文档目录结构 路由注册改进: - 统一使用 Register() 函数注册路由并自动生成文档 - 所有接口必须指定 RouteSpec(Summary, Tags, Input, Output, Auth) - 修复 docs.go 和 gendocs/main.go 使用 RegisterRoutesWithDoc 统一注册 DTO 规范更新: - shop_dto.go 和 shop_account_dto.go 补充完整的 description 标签 - 所有枚举字段必须列出可能值和中文说明 文档生成优化: - admin-openapi.yaml 自动生成更新 - 健康检查和任务管理接口加入文档 - H5 认证接口完整文档化 规范文档管理: - 添加规范文档管理流程说明 - 详细文档放在 docs/ 目录 - AGENTS.md 只保留核心规则和引导链接
92 lines
2.8 KiB
Go
92 lines
2.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"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
func registerShopRoutes(router fiber.Router, handler *admin.ShopHandler, doc *openapi.Generator, basePath string) {
|
|
shops := router.Group("/shops")
|
|
groupPath := basePath + "/shops"
|
|
|
|
Register(shops, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "店铺列表",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(model.ShopListRequest),
|
|
Output: new(model.ShopPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(model.CreateShopRequest),
|
|
Output: new(model.ShopResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(model.UpdateShopParams),
|
|
Output: new(model.ShopResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
|
|
Summary: "删除店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(model.IDReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|
|
|
|
func registerShopAccountRoutes(router fiber.Router, handler *admin.ShopAccountHandler, doc *openapi.Generator, basePath string) {
|
|
shopAccounts := router.Group("/shop-accounts")
|
|
groupPath := basePath + "/shop-accounts"
|
|
|
|
Register(shopAccounts, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "代理账号列表",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(model.ShopAccountListRequest),
|
|
Output: new(model.ShopAccountPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(model.CreateShopAccountRequest),
|
|
Output: new(model.ShopAccountResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(model.UpdateShopAccountParams),
|
|
Output: new(model.ShopAccountResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id/password", handler.UpdatePassword, RouteSpec{
|
|
Summary: "重置代理账号密码",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(model.UpdateShopAccountPasswordParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
|
|
Summary: "启用/禁用代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(model.UpdateShopAccountStatusParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|