fix: update task fields reliably
This commit is contained in:
@@ -113,27 +113,13 @@ func (ts *TaskService) UpdateTask(id string, name, command, schedule string, tim
|
|||||||
if triggerType != "" {
|
if triggerType != "" {
|
||||||
task.TriggerType = triggerType
|
task.TriggerType = triggerType
|
||||||
}
|
}
|
||||||
updates := map[string]interface{}{
|
|
||||||
"name": name,
|
database.DB.Model(&task).Select(
|
||||||
"command": command,
|
"Name", "Command", "Tags", "Schedule", "Timeout", "WorkDir",
|
||||||
"tags": tags,
|
"CleanConfig", "Envs", "Enabled", "AgentID", "Languages",
|
||||||
"schedule": schedule,
|
"RetryCount", "RetryInterval", "RandomRange", "Type",
|
||||||
"timeout": timeout,
|
"TriggerType", "Config",
|
||||||
"work_dir": workDir,
|
).Updates(&task)
|
||||||
"clean_config": cleanConfig,
|
|
||||||
"envs": envs,
|
|
||||||
"enabled": enabled,
|
|
||||||
"agent_id": agentID,
|
|
||||||
"languages": languages,
|
|
||||||
"retry_count": retryCount,
|
|
||||||
"retry_interval": retryInterval,
|
|
||||||
"random_range": randomRange,
|
|
||||||
"type": task.Type,
|
|
||||||
"trigger_type": task.TriggerType,
|
|
||||||
"next_run": task.NextRun,
|
|
||||||
"config": config,
|
|
||||||
}
|
|
||||||
database.DB.Model(&task).Updates(updates)
|
|
||||||
return &task
|
return &task
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user