feat(model): 新增基础数据模型与路由配置

- 新增 BaseModel 结构体,包含统一主键和时间字段
- 定义 JanusProvider、JanusModel、Channel、APIKey 四个业务模型结构
- 引入 Status 枚举表示启用/禁用状态
- 完成对应数据库建表 SQL 迁移脚本
- 新增 router 包及 API 健康检查路由注册实现
- 优化 main.go,使用 router 包统一路由注册管理
- 补充模型中字段的 GORM 和 JSON 标签规范
This commit is contained in:
yangzhaohan
2026-07-14 23:36:41 +08:00
parent 8ef79eb5f8
commit 0794474c04
10 changed files with 496 additions and 5 deletions
+4 -5
View File
@@ -7,6 +7,7 @@ import (
"synoth.com/janus/internal/config"
"synoth.com/janus/internal/database"
"synoth.com/janus/internal/handler"
"synoth.com/janus/internal/router"
)
func main() {
@@ -27,10 +28,8 @@ func main() {
panic(err)
}
router := gin.Default()
r := gin.Default()
healthHandler := &handler.HealthHandler{Database: db}
router.GET("/api/health", healthHandler.Check)
router.Run(fmt.Sprintf(":%d", cfg.Server.Port))
router.SetUp(r, healthHandler)
r.Run(fmt.Sprintf(":%d", cfg.Server.Port))
}