Cleanup
This commit is contained in:
parent
4e503072a8
commit
e3b996c383
4 changed files with 4 additions and 4 deletions
|
@ -6,5 +6,5 @@ type CRUDable interface {
|
||||||
ReadOne(int64) error
|
ReadOne(int64) error
|
||||||
ReadAll(*User) (interface{}, error)
|
ReadAll(*User) (interface{}, error)
|
||||||
Update(int64, *User) error
|
Update(int64, *User) error
|
||||||
Delete(int64, *User) error
|
Delete(int64) error
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
// Delete implements the delete method of CRUDable
|
// Delete implements the delete method of CRUDable
|
||||||
func (l *List) Delete(id int64, doer *User) (err error) {
|
func (l *List) Delete(id int64) (err error) {
|
||||||
// Check if the list exists
|
// Check if the list exists
|
||||||
_, err = GetListByID(id)
|
_, err = GetListByID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
// Delete implements the delete method for listItem
|
// Delete implements the delete method for listItem
|
||||||
func (i *ListItem) Delete(id int64, doer *User) (err error) {
|
func (i *ListItem) Delete(id int64) (err error) {
|
||||||
|
|
||||||
// Check if it exists
|
// Check if it exists
|
||||||
_, err = GetListItemByID(id)
|
_, err = GetListItemByID(id)
|
||||||
|
|
|
@ -23,7 +23,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
|
||||||
return echo.NewHTTPError(http.StatusForbidden)
|
return echo.NewHTTPError(http.StatusForbidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.CObject.Delete(id, &user)
|
err = c.CObject.Delete(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrNeedToBeListAdmin(err) {
|
if models.IsErrNeedToBeListAdmin(err) {
|
||||||
return echo.NewHTTPError(http.StatusForbidden, "You need to be the list admin to delete a list.")
|
return echo.NewHTTPError(http.StatusForbidden, "You need to be the list admin to delete a list.")
|
||||||
|
|
Loading…
Reference in a new issue