1
0

Added lists view

This commit is contained in:
konrad
2018-06-10 14:41:42 +02:00
committed by kolaente
parent b841ec121b
commit 125f0ba230
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package v1
import (
"github.com/labstack/echo"
"git.kolaente.de/konrad/list/models"
"net/http"
)
func GetListsByUser(c echo.Context) error {
currentUser, err := models.GetCurrentUser(c)
if err != nil {
return c.JSON(http.StatusInternalServerError, models.Message{"Could not determine the current user."})
}
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)
}