优化结构

This commit is contained in:
Yvan
2026-08-27 22:33:43 +08:00
parent 5052835fcb
commit e407d3ac10
86 changed files with 3151 additions and 726 deletions
-6
View File
@@ -25,12 +25,6 @@ func SeedDefaults(ctx context.Context, db *gorm.DB, defaults []platformmodule.Ti
if db == nil {
return nil
}
if len(defaults) == 0 {
defaults = []platformmodule.TimedTask{
{Name: "ClearDB", Description: "定时清理数据库过期日志", Spec: "@daily", MethodName: "ClearDB", Enabled: true},
{Name: "CleanStaleUploads", Description: "定时清理过期大文件上传会话", Spec: "@hourly", MethodName: "CleanStaleUploads", Enabled: true},
}
}
return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
for _, item := range defaults {
if strings.TrimSpace(item.Name) == "" {
+2 -5
View File
@@ -1,10 +1,7 @@
package task
import "gorm.io/gorm"
import dataprovider "kra/internal/data/provider"
// Provider is the minimal database seam required by the task tables.
// Task persistence must not depend on the full data runtime or system repos.
type Provider interface {
DB() *gorm.DB
DatabaseReady() bool
}
type Provider = dataprovider.Database