1
0

Getting all lists or one works now

This commit is contained in:
kolaente
2018-07-09 19:49:27 +02:00
parent d5eb2f08e3
commit 9e8f13edf6
6 changed files with 25 additions and 40 deletions

View File

@ -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(&currentUser)
if err != nil {
fmt.Println(err)

View File

@ -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(&currentUser)
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)
}

View File

@ -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 {