diff --git a/routes/api/v1/CRUD_helper.go b/routes/api/v1/CRUD_helper.go index 37c9b607..e8048d3c 100644 --- a/routes/api/v1/CRUD_helper.go +++ b/routes/api/v1/CRUD_helper.go @@ -28,7 +28,7 @@ func (d *DefaultCRUD) Read(id int64) (err error) { // This does web stuff, aka returns json etc. Uses DefaultCRUD Methods to get the data type CRUDWebHandler struct { - CObject CRUD + CObject *DefaultCRUD } // This does json, handles the request @@ -52,6 +52,5 @@ func (c *CRUDWebHandler) ReadOneWeb(ctx echo.Context) error { return ctx.JSON(http.StatusInternalServerError, models.Message{"An error occured."}) } - // TODO how can we return c.CObject.Targetdirectly? - return ctx.JSON(http.StatusOK, c.CObject) + return ctx.JSON(http.StatusOK, c.CObject.Target) } diff --git a/routes/routes.go b/routes/routes.go index 8e9a2f9a..a726df01 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -84,7 +84,6 @@ func RegisterRoutes(e *echo.Echo) { a.POST("/tokenTest", apiv1.CheckToken) a.GET("/lists", apiv1.GetListsByUser) - //a.GET("/lists/:id", apiv1.GetListByID) listHandler := &apiv1.CRUDWebHandler{ CObject: &apiv1.DefaultCRUD{ Target: &models.List{},