implemented team create method
This commit is contained in:
@ -4,10 +4,14 @@ import (
|
||||
"git.kolaente.de/konrad/list/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// CreateWeb is the handler to create an object
|
||||
func (c *WebHandler) CreateWeb(ctx echo.Context) error {
|
||||
// Re-initialize our model
|
||||
c.CObject.Empty()
|
||||
|
||||
// Get the object
|
||||
if err := ctx.Bind(&c.CObject); err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "No or invalid model provided.")
|
||||
@ -53,6 +57,8 @@ func (c *WebHandler) CreateWeb(ctx echo.Context) error {
|
||||
return echo.NewHTTPError(http.StatusNotFound, "The namespace name cannot be empty.")
|
||||
}
|
||||
|
||||
fmt.Println(err)
|
||||
|
||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
|
@ -112,4 +112,13 @@ func RegisterRoutes(e *echo.Echo) {
|
||||
a.POST("/namespaces/:id", namespaceHandler.UpdateWeb)
|
||||
a.DELETE("/namespaces/:id", namespaceHandler.DeleteWeb)
|
||||
a.GET("/namespaces/:id/lists", apiv1.GetListsByNamespaceID)
|
||||
|
||||
teamHandler := &crud.WebHandler{
|
||||
CObject: &models.Team{},
|
||||
}
|
||||
a.GET("/teams", teamHandler.ReadAllWeb)
|
||||
a.GET("/teams/:id", teamHandler.ReadOneWeb)
|
||||
a.PUT("/teams", teamHandler.CreateWeb)
|
||||
a.POST("/teams/:id", teamHandler.UpdateWeb)
|
||||
a.POST("/teams/:id", teamHandler.DeleteWeb)
|
||||
}
|
||||
|
Reference in New Issue
Block a user