fix(软删除): 修复删除钩子调用链并跳过无Docker测试

软删除钩子改用 next.Mutate 处理更新,避免 mutation 类型不匹配
集成测试检测 Docker 可用性,无 Docker 自动跳过
This commit is contained in:
yangjianbo
2026-01-18 16:10:54 +08:00
parent bdc426a774
commit fb839ae6ca
2 changed files with 45 additions and 4 deletions

View File

@@ -112,9 +112,6 @@ func (d SoftDeleteMixin) Hooks() []ent.Hook {
SetOp(ent.Op)
SetDeletedAt(time.Time)
WhereP(...func(*sql.Selector))
Client() interface {
Mutate(context.Context, ent.Mutation) (ent.Value, error)
}
})
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
@@ -125,7 +122,7 @@ func (d SoftDeleteMixin) Hooks() []ent.Hook {
mx.SetOp(ent.OpUpdate)
// 设置删除时间为当前时间
mx.SetDeletedAt(time.Now())
return mx.Client().Mutate(ctx, m)
return next.Mutate(ctx, m)
})
},
}