Commit 8697ebe6 authored by zauberstuhl's avatar zauberstuhl

Enable SelectStructFields for Aspects.Index call

parent 2dc9d440
...@@ -19,6 +19,7 @@ package controllers ...@@ -19,6 +19,7 @@ package controllers
import ( import (
"github.com/revel/revel" "github.com/revel/revel"
"gopkg.in/ganggo/api.v0/app/helpers"
"gopkg.in/ganggo/ganggo.v0/app/models" "gopkg.in/ganggo/ganggo.v0/app/models"
"errors" "errors"
) )
...@@ -91,14 +92,15 @@ func (a ApiAspect) DeletePerson() revel.Result { ...@@ -91,14 +92,15 @@ func (a ApiAspect) DeletePerson() revel.Result {
return a.RenderJSON(membership) return a.RenderJSON(membership)
} }
func (a ApiAspect) Index() revel.Result { func (a ApiAspect) Index(fields string) revel.Result {
user, err := models.CurrentUser(a.Params, a.Session) user, err := models.CurrentUser(a.Params, a.Session)
if err != nil { if err != nil {
revel.AppLog.Error("Failed to get current user :%s", err.Error()) revel.AppLog.Error("Failed to get current user :%s", err.Error())
return a.RenderApiError(err) return a.RenderApiError(err)
} }
return a.RenderJSON(user.Aspects) return a.RenderJSON(
helpers.SelectStructFields(user.Aspects, fields))
} }
func (a ApiAspect) Create() revel.Result { func (a ApiAspect) Create() revel.Result {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment