feat: add repo sync page

This commit is contained in:
engigu
2025-12-25 17:55:54 +08:00
parent bf47048f8f
commit f096d6dea4
9 changed files with 655 additions and 22 deletions
+11 -2
View File
@@ -11,10 +11,15 @@ func NewTaskService() *TaskService {
return &TaskService{}
}
func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, workDir, cleanConfig, envs string) *models.Task {
func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, workDir, cleanConfig, envs, taskType, config string) *models.Task {
if taskType == "" {
taskType = "task"
}
task := &models.Task{
Name: name,
Command: command,
Type: taskType,
Config: config,
Schedule: schedule,
Timeout: timeout,
WorkDir: workDir,
@@ -56,7 +61,7 @@ func (ts *TaskService) GetTaskByID(id int) *models.Task {
return &task
}
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeout int, workDir, cleanConfig, envs string, enabled bool) *models.Task {
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeout int, workDir, cleanConfig, envs string, enabled bool, taskType, config string) *models.Task {
var task models.Task
if err := database.DB.First(&task, id).Error; err != nil {
return nil
@@ -69,6 +74,10 @@ func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeou
task.CleanConfig = cleanConfig
task.Envs = envs
task.Enabled = enabled
if taskType != "" {
task.Type = taskType
}
task.Config = config
database.DB.Save(&task)
return &task
}