Files
panel/internal/route/database.go
T
renovate[bot] 1df45f438b chore(deps): Update non-major dependencies (#1750)
* chore(deps): Update non-major dependencies

* fix: 适配 libtnb validator v0.4.3 与 cron v0.5.4 新 API

- 自定义规则改经 WithRules/WithFallibleRules 注入,exists/not_exists 转为
  FallibleRule 让数据库错误上抛而非静默失败
- openapi contrib 移除运行时 Op,端点文档改为 Document 闭包在定义处捕获类型
- SetDefault 已移除,Bind 校验器改由 service.SetValidator 注入
- cron.New 现在返回 error

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 23:11:15 +08:00

30 lines
1.1 KiB
Go

package route
import (
"net/http"
"github.com/acepanel/panel/v3/internal/biz"
"github.com/acepanel/panel/v3/internal/request"
"github.com/acepanel/panel/v3/internal/service"
)
// DatabaseRoutes 数据库路由
func DatabaseRoutes(databaseService *service.DatabaseService) Endpoints {
svc := databaseService
return Endpoints{
{Method: http.MethodGet, Path: "/api/database", Handler: svc.List,
Summary: "获取数据库列表", Tags: []string{"数据库"},
Document: Describe[request.DatabaseList, service.Envelope[service.Page[*biz.Database]]]()},
{Method: http.MethodPost, Path: "/api/database", Handler: svc.Create,
Summary: "创建数据库", Tags: []string{"数据库"},
Document: DescribeReq[request.DatabaseCreate]()},
{Method: http.MethodDelete, Path: "/api/database", Handler: svc.Delete,
Summary: "删除数据库", Tags: []string{"数据库"},
Document: DescribeReq[request.DatabaseDelete]()},
{Method: http.MethodPost, Path: "/api/database/comment", Handler: svc.Comment,
Summary: "设置数据库注释", Tags: []string{"数据库"},
Document: DescribeReq[request.DatabaseComment]()},
}
}