feat: add startup task and fix backup import
This commit is contained in:
@@ -38,6 +38,7 @@ type Task struct {
|
||||
Name string `json:"name" gorm:"size:255;not null"`
|
||||
Command string `json:"command" gorm:"type:text"` // 普通任务的命令
|
||||
Type string `json:"type" gorm:"size:20;default:'task'"` // 任务类型: constant.TaskTypeNormal, constant.TaskTypeRepo
|
||||
TriggerType string `json:"trigger_type" gorm:"size:25;default:'cron'"` // 触发类型: constant.TriggerTypeCron, constant.TriggerTypeBaihuStartup
|
||||
Config string `json:"config" gorm:"type:text"` // 配置 JSON(仓库同步配置等)
|
||||
Schedule string `json:"schedule" gorm:"size:100"` // cron 表达式
|
||||
Timeout int `json:"timeout" gorm:"default:30"` // 超时时间(分钟),默认30分钟
|
||||
|
||||
@@ -11,6 +11,7 @@ type TaskVO struct {
|
||||
Name string `json:"name"`
|
||||
Command string `json:"command"`
|
||||
Type string `json:"type"`
|
||||
TriggerType string `json:"trigger_type"`
|
||||
Config string `json:"config"`
|
||||
Schedule string `json:"schedule"`
|
||||
Timeout int `json:"timeout"`
|
||||
@@ -36,6 +37,7 @@ func ToTaskVO(task *models.Task) *TaskVO {
|
||||
Name: task.Name,
|
||||
Command: task.Command,
|
||||
Type: task.Type,
|
||||
TriggerType: task.TriggerType,
|
||||
Config: task.Config,
|
||||
Schedule: task.Schedule,
|
||||
Timeout: task.Timeout,
|
||||
|
||||
Reference in New Issue
Block a user