重构:统一应用服务与基础设施适配边界
将账号、认证、管理员、分析、自动化、卡券、聊天、商品、关键词、设置和订单能力迁移到 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
@@ -76,6 +76,26 @@ func TestLoginAndMiddleware(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestIdentityFromContextReturnsMinimalUserView 验证通用 HTTP 辅助只接收用户标识而不暴露完整数据库会话。
|
||||
func TestIdentityFromContextReturnsMinimalUserView(t *testing.T) {
|
||||
// ctx 保存包含完整会话的测试上下文,模拟认证中间件已经完成会话解析。
|
||||
ctx := WithSession(context.Background(), &db.Session{UserID: 42, Username: "admin", IsAdmin: true})
|
||||
// identity 保存认证包裁剪后的最小用户身份视图。
|
||||
identity := IdentityFromContext(ctx)
|
||||
if identity == nil || identity.UserID != 42 {
|
||||
t.Fatalf("身份视图异常: %+v", identity)
|
||||
}
|
||||
}
|
||||
|
||||
// TestIdentityFromContextReturnsNilWithoutSession 验证未认证请求不会伪造用户身份。
|
||||
func TestIdentityFromContextReturnsNilWithoutSession(t *testing.T) {
|
||||
// identity 保存无会话上下文经过认证包裁剪后的结果,应保持为空。
|
||||
identity := IdentityFromContext(context.Background())
|
||||
if identity != nil {
|
||||
t.Fatalf("无会话时应返回 nil,得到 %+v", identity)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRequireAuthAndAdmin 负责TestRequireAuthAndAdmin相关处理。
|
||||
func TestRequireAuthAndAdmin(t *testing.T) {
|
||||
// svc、cleanup 保存svc、cleanup,供当前处理流程使用
|
||||
|
||||
Reference in new issue
Block a user