refactor(admin): decouple system cleanup with event bus and enforce single owner principle

This commit is contained in:
ryan
2026-09-03 08:50:37 +08:00
parent 1e19d8114a
commit 6b28adfacf
14 changed files with 419 additions and 50 deletions
+7
View File
@@ -151,6 +151,13 @@ func (p *Plugin) Apply(ctx *core.Context) error {
ctx.Task().Register(TaskCleanupInactive, &CleanupInactiveHandler{},
extpoints.WithTaskMeta(CleanupInactiveMeta))
// 4.1 Register Event Listeners for domain events
ctx.Events().On(contracts.EventTopicSystemCleanup, func(c context.Context, _ contracts.SystemCleanupEvent) error {
handler := &CleanupInactiveHandler{}
_, err := handler.Execute(c, nil)
return err
})
// 5. Register Settings Schemas
ctx.Settings().Register(extpoints.SettingSchema{
Key: "user.registration_enabled",