Implemented create and update methods for items

This commit is contained in:
konrad 2018-07-11 02:39:55 +02:00 committed by kolaente
parent 592dc20af4
commit ee4a904e35
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
4 changed files with 34 additions and 114 deletions

View file

@ -4,6 +4,7 @@ import (
"git.kolaente.de/konrad/list/models"
"github.com/labstack/echo"
"net/http"
"fmt"
)
// UpdateWeb is the webhandler to update an object
@ -28,6 +29,7 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
// Do the update
err = c.CObject.Update(id, &currentUser)
if err != nil {
fmt.Println(err)
if models.IsErrNeedToBeListAdmin(err) {
return echo.NewHTTPError(http.StatusForbidden, "You need to be list admin to do that.")
}