Constraint: 切换 main 前必须保存当前七月分支全部项目进展,套餐生效提案仅属于 Iteration/7-11。 Rejected: 将七月套餐修复直接移植到 main | 两个分支的可靠投递架构不同。 Confidence: medium Scope-risk: broad Directive: 不得将本提交整体 cherry-pick 到 main;main 套餐热修必须基于其纯 Asynq 代码独立实施。 Tested: git diff --check;openspec validate fix-package-activation-starvation --strict。 Not-tested: 按用户要求未运行自动化测试;go build ./... 因当前审计改造中的 Enterprise 模型字面量和 role.recordFailure 参数类型错误未通过。
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
// Package accountaudit 定义账号生命周期写入统一审计的应用边界。
|
|
package accountaudit
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/model"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// LifecycleAudit 是账号生命周期用例提交给统一 Writer 的业务事实。
|
|
type LifecycleAudit struct {
|
|
ActionCode string
|
|
Summary string
|
|
Result string
|
|
ErrorCode string
|
|
ErrorSummary string
|
|
Account *model.Account
|
|
Shop *model.Shop
|
|
Enterprise *model.Enterprise
|
|
Roles []*model.Role
|
|
BeforeData map[string]any
|
|
AfterData map[string]any
|
|
}
|
|
|
|
// SecurityAudit 是账号安全用例提交给统一 Writer 的无凭据业务事实。
|
|
type SecurityAudit struct {
|
|
ActionCode string
|
|
Summary string
|
|
Result string
|
|
ErrorCode string
|
|
ErrorSummary string
|
|
ActorID uint
|
|
ActorName string
|
|
Account *model.Account
|
|
AuthenticationKey string
|
|
Authentication map[string]any
|
|
BeforeData map[string]any
|
|
AfterData map[string]any
|
|
}
|
|
|
|
// Writer 在调用方提供的事务内追加账号生命周期事件。
|
|
type Writer interface {
|
|
WriteAccountLifecycle(ctx context.Context, tx *gorm.DB, audit LifecycleAudit) error
|
|
WriteAccountSecurity(ctx context.Context, tx *gorm.DB, audit SecurityAudit) error
|
|
}
|