优化结构
This commit is contained in:
@@ -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) == "" {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user