implemented namespace creation via interface method
This commit is contained in:
@ -31,7 +31,7 @@ func AddNamespace(c echo.Context) error {
|
||||
// "500":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
return addOrUpdateNamespace(c)
|
||||
return echo.NewHTTPError(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// UpdateNamespace ...
|
||||
@ -63,7 +63,7 @@ func UpdateNamespace(c echo.Context) error {
|
||||
// "500":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
return addOrUpdateNamespace(c)
|
||||
return echo.NewHTTPError(http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// AddOrUpdateNamespace Adds or updates a new namespace
|
||||
|
@ -44,6 +44,13 @@ 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.")
|
||||
}
|
||||
|
||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ func RegisterRoutes(e *echo.Echo) {
|
||||
CObject: &models.Namespace{},
|
||||
}
|
||||
a.GET("/namespaces", namespaceHandler.ReadAllWeb)
|
||||
a.PUT("/namespaces", apiv1.AddNamespace)
|
||||
a.PUT("/namespaces", namespaceHandler.CreateWeb)
|
||||
a.GET("/namespaces/:id", apiv1.ShowNamespace)
|
||||
a.POST("/namespaces/:id", apiv1.UpdateNamespace)
|
||||
a.DELETE("/namespaces/:id", apiv1.DeleteNamespaceByID)
|
||||
|
Reference in New Issue
Block a user