重构:统一应用服务与基础设施适配边界
将账号、认证、管理员、分析、自动化、卡券、聊天、商品、关键词、设置和订单能力迁移到 application 与 adapter,删除 Server 内对应的旧仓储和业务服务实现,并收紧架构检查。 完善批量发布与订单刷新生命周期、凭证写回、账号任务补偿、订单 reconciliation、通知和敏感数据边界;补充正常、失败、取消、并发、越权及多方言回归测试,并修正 MySQL 延迟任务表的 InnoDB 配置。 修复空卡密响应为 null 时前端加载失败的问题,重建嵌入式前端资产;重写重构总计划,清除历史流水并明确阶段 1 至 10 各对应一次完整迭代和一个 PR。 验证:make check;make test-server-race;npm test/typecheck/comments:check/build;Docker SQLite/MySQL 8.4/PostgreSQL 17 TestMultiDB_*。
This commit is contained in:
1 parent
19a7d5f924
commit
375e84d663
239 files changed
+23870
-7871
No files matched your search
@@ -11,6 +11,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"xianyu-go/internal/account"
|
||||
"xianyu-go/internal/adapter"
|
||||
"xianyu-go/internal/auth"
|
||||
"xianyu-go/internal/automation"
|
||||
"xianyu-go/internal/chat"
|
||||
"xianyu-go/internal/db"
|
||||
@@ -36,7 +38,15 @@ func newTestServer(t *testing.T) (*Server, *db.Store, func()) { // newTestServer
|
||||
// mgr 是使用空处理器的测试账号管理器。
|
||||
mgr := account.NewManager(store, noopHandler{}, nil)
|
||||
// srv 是未启用聊天服务的基础测试 HTTP 服务。
|
||||
srv, err := New(store, mgr, false, "", ":0", nil, nil, nil)
|
||||
// dependencies 保存测试 Server 使用的基础设施工厂,避免 Server 直接持有 Store。
|
||||
dependencies, dependencyErr := adapter.NewDependencies(store)
|
||||
if dependencyErr != nil {
|
||||
t.Fatalf("NewDependencies: %v", dependencyErr)
|
||||
}
|
||||
// authentication 保存测试 HTTP 会话中间件需要的认证服务。
|
||||
authentication := &auth.Service{Store: store}
|
||||
// srv、err 保存测试 HTTP 服务构造结果及失败原因。
|
||||
srv, err := New(dependencies, authentication, mgr, "", ":0", nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
@@ -85,7 +95,15 @@ func newUninitializedTestServer(t *testing.T) (*Server, *db.Store, func()) {
|
||||
// mgr 是未初始化测试使用的空处理器账号管理器。
|
||||
mgr := account.NewManager(store, noopHandler{}, nil)
|
||||
// srv 是未初始化测试使用的 HTTP 服务实例。
|
||||
srv, err := New(store, mgr, false, "", ":0", nil, nil, nil)
|
||||
// dependencies 保存未初始化测试 Server 使用的基础设施工厂。
|
||||
dependencies, dependencyErr := adapter.NewDependencies(store)
|
||||
if dependencyErr != nil {
|
||||
t.Fatalf("NewDependencies: %v", dependencyErr)
|
||||
}
|
||||
// authentication 保存未初始化数据库上的会话中间件依赖。
|
||||
authentication := &auth.Service{Store: store}
|
||||
// srv、err 保存未初始化测试服务构造结果及失败原因。
|
||||
srv, err := New(dependencies, authentication, mgr, "", ":0", nil, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user