1
0

Added color field to tasks

This commit is contained in:
kolaente
2019-04-30 11:26:37 +02:00
parent 733d0be753
commit 24704bd4ed
8 changed files with 118 additions and 15 deletions

View File

@ -192,4 +192,11 @@
list_id: 1
created: 1543626724
updated: 1543626724
- id: 31
text: 'task #31 with color'
created_by_id: 1
list_id: 1
hex_color: f0f0f0
created: 1543626724
updated: 1543626724

View File

@ -52,6 +52,8 @@ type ListTask struct {
Assignees []*User `xorm:"-" json:"assignees"`
// An array of labels which are associated with this task.
Labels []*Label `xorm:"-" json:"labels"`
// The task color in hex
HexColor string `xorm:"varchar(6) null" json:"hexColor" valid:"runelength(0|6)" maxLength:"6"`
Sorting string `xorm:"-" json:"-" query:"sort"` // Parameter to sort by
StartDateSortUnix int64 `xorm:"-" json:"-" query:"startdate"`

View File

@ -173,6 +173,10 @@ func (t *ListTask) Update() (err error) {
if t.EndDateUnix == 0 {
ot.EndDateUnix = 0
}
// Color
if t.HexColor == "" {
ot.HexColor = ""
}
_, err = x.ID(t.ID).
Cols("text",
@ -184,7 +188,8 @@ func (t *ListTask) Update() (err error) {
"parent_task_id",
"priority",
"start_date_unix",
"end_date_unix").
"end_date_unix",
"hex_color").
Update(ot)
*t = ot
return