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 只保留核心规则和引导链接
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/bootstrap"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
// RegisterRoutes 路由注册总入口
|
|
// 按业务模块调用各自的路由注册函数
|
|
func RegisterRoutes(app *fiber.App, handlers *bootstrap.Handlers, middlewares *bootstrap.Middlewares) {
|
|
RegisterRoutesWithDoc(app, handlers, middlewares, nil)
|
|
}
|
|
|
|
// RegisterRoutesWithDoc 路由注册总入口(支持文档生成)
|
|
func RegisterRoutesWithDoc(app *fiber.App, handlers *bootstrap.Handlers, middlewares *bootstrap.Middlewares, doc *openapi.Generator) {
|
|
// 1. 全局路由
|
|
registerHealthRoutes(app, doc)
|
|
|
|
// 2. Admin 域 (挂载在 /api/admin)
|
|
adminGroup := app.Group("/api/admin")
|
|
RegisterAdminRoutes(adminGroup, handlers, middlewares, doc, "/api/admin")
|
|
|
|
// 任务相关路由 (归属于 Admin 域)
|
|
registerTaskRoutes(adminGroup, doc, "/api/admin")
|
|
|
|
// 3. H5 域 (挂载在 /api/h5)
|
|
h5Group := app.Group("/api/h5")
|
|
RegisterH5Routes(h5Group, handlers, middlewares, doc, "/api/h5")
|
|
|
|
// 4. 个人客户路由 (挂载在 /api/c/v1)
|
|
RegisterPersonalCustomerRoutes(app, handlers, middlewares.PersonalAuth)
|
|
}
|