Added endpoint to be able to edit list items
This commit is contained in:
parent
1b3b2ccb59
commit
fc974fd87f
4 changed files with 51 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
Reference in a new issue