feat: add repo sync page
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user