implemented namespace update via interface method
This commit is contained in:
@ -44,9 +44,6 @@ func (c *WebHandler) CreateWeb(ctx echo.Context) error {
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You need to have write access on that list.")
|
||||
}
|
||||
|
||||
if models.IsErrNamespaceDoesNotExist(err) {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "The namespace does not exist.")
|
||||
}
|
||||
if models.IsErrNamespaceNameCannotBeEmpty(err) {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "The namespace name cannot be empty.")
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package crud
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.kolaente.de/konrad/list/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
@ -29,11 +28,21 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
|
||||
// Do the update
|
||||
err = c.CObject.Update(id, ¤tUser)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
if models.IsErrNeedToBeListAdmin(err) {
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You need to be list admin to do that.")
|
||||
}
|
||||
|
||||
|
||||
if models.IsErrNamespaceDoesNotExist(err) {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "The namespace does not exist.")
|
||||
}
|
||||
if models.IsErrNamespaceNameCannotBeEmpty(err) {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "The namespace name cannot be empty.")
|
||||
}
|
||||
if models.IsErrNamespaceOwnerCannotBeEmpty(err) {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "The namespace owner cannot be empty.")
|
||||
}
|
||||
|
||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user