1
0
This commit is contained in:
konrad
2018-06-10 14:43:35 +02:00
committed by kolaente
parent 125f0ba230
commit cf4871af59
3 changed files with 26 additions and 24 deletions

View File

@ -0,0 +1,22 @@
package models
// CreateOrUpdateList updates a list or creates it if it doesn't exist
func CreateOrUpdateList(list *List) (err error) {
// Check if it exists
_, err = GetListByID(list.ID)
if err != nil {
return
}
list.OwnerID = list.Owner.ID
if list.ID == 0 {
_, err = x.Insert(list)
} else {
_, err = x.ID(list.ID).Update(list)
return
}
return
}