1
0

Added docs via swagger

This commit is contained in:
kolaente
2018-06-13 13:45:22 +02:00
parent 0652125c25
commit 4589f3b4bb
17 changed files with 410 additions and 48 deletions

View File

@ -17,21 +17,23 @@ func CreateOrUpdateListItem(item *ListItem) (newItem *ListItem, err error) {
item.CreatedByID = item.CreatedBy.ID
item.CreatedBy = user
// TODO: Check if the user has the right to add/update an item to that list
if item.ID != 0 {
_, err = x.ID(item.ID).Update(item)
if err != nil {
return
}
} else {
_, err = x.Insert(item)
if err != nil {
return
}
// Check if we have at least a text
if item.Text == "" {
return newItem, ErrListItemCannotBeEmpty{}
}
_, err = x.Insert(item)
if err != nil {
return
}
}
// Get the new/updated item