1
0

implemented delete list item via CRUD

This commit is contained in:
konrad
2018-07-11 11:44:17 +02:00
committed by kolaente
parent 281e9c1cd0
commit 5c4fb7ed73
5 changed files with 47 additions and 61 deletions

View File

@ -0,0 +1,20 @@
package models
// Delete implements the delete method for listItem
func (i *ListItem) Delete(id int64, doer *User) (err error) {
// Check if it exists
listitem, err := GetListItemByID(id)
if err != nil {
return
}
// Check if the user hat the right to delete that item
_, err = listItemPreCheck(i, doer, listitem.ListID)
if err != nil {
return
}
_, err = x.ID(id).Delete(ListItem{})
return
}