Added endpoint to be able to edit list items

This commit is contained in:
konrad 2018-06-12 19:44:47 +02:00 committed by kolaente
parent 1b3b2ccb59
commit fc974fd87f
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
4 changed files with 51 additions and 24 deletions

View file

@ -3,11 +3,6 @@ package models
// CreateOrUpdateListItem adds or updates a todo item to a list
func CreateOrUpdateListItem(item *ListItem) (err error) {
// Check if we have at least a text
if item.Text == "" {
return ErrListItemCannotBeEmpty{}
}
// Check if the list exists
_, err = GetListByID(item.ListID)
if err != nil {
@ -31,6 +26,11 @@ func CreateOrUpdateListItem(item *ListItem) (err error) {
if err != nil {
return
}
// Check if we have at least a text
if item.Text == "" {
return ErrListItemCannotBeEmpty{}
}
}
return