Added isStarred to search result hit, very inefficient loading right now but can be cached later on

This commit is contained in:
Torkel Ödegaard
2015-02-05 09:49:00 +01:00
parent 69e7279cff
commit 076905d14e
7 changed files with 45 additions and 30 deletions
-20
View File
@@ -1,9 +1,6 @@
package api
import (
"strconv"
"github.com/torkelo/grafana-pro/pkg/api/dtos"
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/middleware"
m "github.com/torkelo/grafana-pro/pkg/models"
@@ -46,20 +43,3 @@ func UnstarDashboard(c *middleware.Context) {
c.JsonOK("Dashboard unstarred")
}
func GetUserStars(c *middleware.Context) {
query := m.GetUserStarsQuery{UserId: c.UserId}
if err := bus.Dispatch(&query); err != nil {
c.JsonApiErr(500, "Failed to get user stars", err)
return
}
var result dtos.UserStars
result.DashboardIds = make(map[string]bool)
for _, star := range query.Result {
result.DashboardIds[strconv.FormatInt(star.DashboardId, 10)] = true
}
c.JSON(200, &result)
}