Getting all lists or one works now
This commit is contained in:
@ -44,8 +44,6 @@ func (c *CRUDWebHandler) ReadAllWeb(ctx echo.Context) error {
|
||||
return ctx.JSON(http.StatusInternalServerError, models.Message{"Could not determine the current user."})
|
||||
}
|
||||
|
||||
//c.CObject.IsAdmin()
|
||||
|
||||
lists, err := c.CObject.ReadAll(¤tUser)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"git.kolaente.de/konrad/list/models"
|
||||
"github.com/labstack/echo"
|
||||
"net/http"
|
||||
)
|
||||
@ -21,7 +20,7 @@ func GetListsByUser(c echo.Context) error {
|
||||
// "500":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
currentUser, err := models.GetCurrentUser(c)
|
||||
/*currentUser, err := models.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"Could not determine the current user."})
|
||||
}
|
||||
@ -29,7 +28,7 @@ func GetListsByUser(c echo.Context) error {
|
||||
allLists, err := models.GetListsByUser(¤tUser)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"Could not get lists."})
|
||||
}
|
||||
}*/
|
||||
|
||||
return c.JSON(http.StatusOK, allLists)
|
||||
return c.JSON(http.StatusOK, nil)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func NewEcho() *echo.Echo {
|
||||
|
||||
// Logger
|
||||
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
|
||||
Format: "${time_rfc3339}: ${remote_ip} ${method} ${status} ${uri} ${latency_human} - ${user_agent}\n",
|
||||
Format: "${time_rfc3339_nano}: ${remote_ip} ${method} ${status} ${uri} ${latency_human} - ${user_agent}\n",
|
||||
}))
|
||||
|
||||
return e
|
||||
@ -50,6 +50,9 @@ func NewEcho() *echo.Echo {
|
||||
// RegisterRoutes registers all routes for the application
|
||||
func RegisterRoutes(e *echo.Echo) {
|
||||
|
||||
|
||||
// TODO: Use proper cors middleware by echo
|
||||
|
||||
// Middleware for cors
|
||||
e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
|
Reference in New Issue
Block a user