refactor!: 迁移至 samber/do 依赖注入与三层架构

依赖注入:
- 移除 google/wire(含 wire.go/wire_gen.go 与全部 ProviderSet),
  改用 samber/do v2 单注入器 + 双入口惰性构建
- 贡献模型替代命令式注册:路由 routes:、命令 commands:、
  任务 jobs: 前缀经 internal/registry 收集与校验
- 构造函数统一 func NewXxx(i do.Injector) (T, error)

三层架构:
- 补全用例层:每个 biz.XxxRepo 配 XxxUsecase,
  service/command/job 表现层只依赖用例,不再直接引用仓储

路由与文档:
- route/http.go 按域拆为声明式 Endpoint 贡献,
  Endpoint 承载登录白名单与端点限流语义
- 调试模式下提供 OpenAPI 3.1 文档:/openapi.json 与 /docs(Scalar),
  从 validate 标签生成

目录与依赖:
- internal/http/{middleware,request,rule} 拍平至 internal/*
- CLI 命令拆至 internal/command
- 日志轮转 timberjack 换为 libtnb/logrotate
- 升级 validator/cron/sessions/gormstore/sqlite/securecookie
- 数据库迁移保持 gormigrate 不变

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
耗子
2026-07-09 21:54:22 +08:00
parent 6f0593fbf8
commit 443516a2cf
331 changed files with 5526 additions and 2852 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// BackupAccountRepo is an autogenerated mock type for the BackupAccountRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// CertAccountRepo is an autogenerated mock type for the CertAccountRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// CertDNSRepo is an autogenerated mock type for the CertDNSRepo type
+1 -1
View File
@@ -10,7 +10,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
types "github.com/acepanel/panel/v3/pkg/types"
+1 -1
View File
@@ -3,7 +3,7 @@
package biz
import (
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
types "github.com/acepanel/panel/v3/pkg/types"
mock "github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package biz
import (
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
types "github.com/acepanel/panel/v3/pkg/types"
mock "github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package biz
import (
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
types "github.com/acepanel/panel/v3/pkg/types"
mock "github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package biz
import (
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
types "github.com/acepanel/panel/v3/pkg/types"
mock "github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// CronRepo is an autogenerated mock type for the CronRepo type
+1 -1
View File
@@ -6,7 +6,7 @@ import (
db "github.com/acepanel/panel/v3/pkg/db"
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// DatabaseElasticsearchRepo is an autogenerated mock type for the DatabaseElasticsearchRepo type
+1 -1
View File
@@ -6,7 +6,7 @@ import (
db "github.com/acepanel/panel/v3/pkg/db"
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// DatabaseRedisRepo is an autogenerated mock type for the DatabaseRedisRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// DatabaseRepo is an autogenerated mock type for the DatabaseRepo type
+1 -1
View File
@@ -6,7 +6,7 @@ import (
biz "github.com/acepanel/panel/v3/internal/biz"
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// DatabaseServerRepo is an autogenerated mock type for the DatabaseServerRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// DatabaseUserRepo is an autogenerated mock type for the DatabaseUserRepo type
+1 -1
View File
@@ -6,7 +6,7 @@ import (
biz "github.com/acepanel/panel/v3/internal/biz"
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
time "time"
)
+1 -1
View File
@@ -5,7 +5,7 @@ package biz
import (
context "context"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
mock "github.com/stretchr/testify/mock"
types "github.com/acepanel/panel/v3/pkg/types"
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// SSHRepo is an autogenerated mock type for the SSHRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// SettingRepo is an autogenerated mock type for the SettingRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
)
// WebHookRepo is an autogenerated mock type for the WebHookRepo type
+1 -1
View File
@@ -9,7 +9,7 @@ import (
mock "github.com/stretchr/testify/mock"
request "github.com/acepanel/panel/v3/internal/http/request"
request "github.com/acepanel/panel/v3/internal/request"
time "time"