@@ -4,9 +4,10 @@ import (
44 "encoding/json"
55 "errors"
66 "fmt"
7- "github.com/semaphoreui/semaphore/pkg/tz"
87 "time"
98
9+ "github.com/semaphoreui/semaphore/pkg/tz"
10+
1011 "github.com/go-gorp/gorp/v3"
1112
1213 "github.com/semaphoreui/semaphore/pkg/task_logger"
@@ -44,35 +45,35 @@ type Task struct {
4445
4546 // override variables
4647 Playbook string `db:"playbook" json:"playbook"`
47- Environment string `db:"environment" json:"environment"`
48- Secret string `db:"-" json:"secret"`
49- Arguments * string `db:"arguments" json:"arguments"`
50- GitBranch * string `db:"git_branch" json:"git_branch"`
48+ Environment string `db:"environment" json:"environment,omitempty "`
49+ Secret string `db:"-" json:"secret,omitempty "`
50+ Arguments * string `db:"arguments" json:"arguments,omitempty "`
51+ GitBranch * string `db:"git_branch" json:"git_branch,omitempty "`
5152
52- UserID * int `db:"user_id" json:"user_id"`
53- IntegrationID * int `db:"integration_id" json:"integration_id"`
54- ScheduleID * int `db:"schedule_id" json:"schedule_id"`
53+ UserID * int `db:"user_id" json:"user_id,omitempty "`
54+ IntegrationID * int `db:"integration_id" json:"integration_id,omitempty "`
55+ ScheduleID * int `db:"schedule_id" json:"schedule_id,omitempty "`
5556
5657 Created time.Time `db:"created" json:"created"`
57- Start * time.Time `db:"start" json:"start"`
58- End * time.Time `db:"end" json:"end"`
58+ Start * time.Time `db:"start" json:"start,omitempty "`
59+ End * time.Time `db:"end" json:"end,omitempty "`
5960
60- Message string `db:"message" json:"message"`
61+ Message string `db:"message" json:"message,omitempty "`
6162
6263 // CommitMessage is a git commit hash of playbook repository which
6364 // was active when task was created.
64- CommitHash * string `db:"commit_hash" json:"commit_hash"`
65+ CommitHash * string `db:"commit_hash" json:"commit_hash,omitempty "`
6566 // CommitMessage contains message retrieved from git repository after checkout to CommitHash.
6667 // It is readonly by API.
67- CommitMessage string `db:"commit_message" json:"commit_message"`
68- BuildTaskID * int `db:"build_task_id" json:"build_task_id"`
68+ CommitMessage string `db:"commit_message" json:"commit_message,omitempty "`
69+ BuildTaskID * int `db:"build_task_id" json:"build_task_id,omitempty "`
6970 // Version is a build version.
7071 // This field available only for Build tasks.
71- Version * string `db:"version" json:"version"`
72+ Version * string `db:"version" json:"version,omitempty "`
7273
73- InventoryID * int `db:"inventory_id" json:"inventory_id"`
74+ InventoryID * int `db:"inventory_id" json:"inventory_id,omitempty "`
7475
75- Params MapStringAnyField `db:"params" json:"params"`
76+ Params MapStringAnyField `db:"params" json:"params,omitempty "`
7677}
7778
7879func (task * Task ) FillParams (target interface {}) (err error ) {
@@ -169,10 +170,10 @@ type TaskWithTpl struct {
169170 Task
170171 TemplatePlaybook string `db:"tpl_playbook" json:"tpl_playbook"`
171172 TemplateAlias string `db:"tpl_alias" json:"tpl_alias"`
172- TemplateType TemplateType `db:"tpl_type" json:"tpl_type"`
173- TemplateApp TemplateApp `db:"tpl_app" json:"tpl_app"`
174- UserName * string `db:"user_name" json:"user_name"`
175- BuildTask * Task `db:"-" json:"build_task"`
173+ TemplateType TemplateType `db:"tpl_type" json:"tpl_type,omitempty "`
174+ TemplateApp TemplateApp `db:"tpl_app" json:"tpl_app,omitempty "`
175+ UserName * string `db:"user_name" json:"user_name,omitempty "`
176+ BuildTask * Task `db:"-" json:"build_task,omitempty "`
176177}
177178
178179// TaskOutput is the ansible log output from the task
0 commit comments