1
0

Colors for lists and namespaces (#155)

Add Hex Color properties migration

Add Hex Color properties

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/api/pulls/155
This commit is contained in:
konrad
2020-03-22 21:09:32 +00:00
parent 35f05cbbec
commit 7b619bd084
4 changed files with 101 additions and 0 deletions

View File

@ -34,6 +34,8 @@ type List struct {
Description string `xorm:"longtext null" json:"description"`
// The unique list short identifier. Used to build task identifiers.
Identifier string `xorm:"varchar(10) null" json:"identifier" valid:"runelength(0|10)" minLength:"0" maxLength:"10"`
// The hex color of this list
HexColor string `xorm:"varchar(6) null" json:"hex_color" valid:"runelength(0|6)" maxLength:"6"`
OwnerID int64 `xorm:"int(11) INDEX not null" json:"-"`
NamespaceID int64 `xorm:"int(11) INDEX not null" json:"-" param:"namespace"`
@ -382,6 +384,9 @@ func CreateOrUpdateList(list *List) (err error) {
if list.Identifier != "" {
colsToUpdate = append(colsToUpdate, "identifier")
}
if list.HexColor != "" {
colsToUpdate = append(colsToUpdate, "hex_color")
}
_, err = x.
ID(list.ID).