forked from knadh/listmonk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.go
30 lines (24 loc) · 910 Bytes
/
dashboard.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package core
import (
"net/http"
"github.com/jmoiron/sqlx/types"
"github.com/labstack/echo/v4"
)
// GetDashboardCharts returns chart data points to render on the dashboard.
func (c *Core) GetDashboardCharts() (types.JSONText, error) {
var out types.JSONText
if err := c.q.GetDashboardCharts.Get(&out); err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorFetching", "name", "dashboard charts", "error", pqErrMsg(err)))
}
return out, nil
}
// GetDashboardCounts returns stats counts to show on the dashboard.
func (c *Core) GetDashboardCounts() (types.JSONText, error) {
var out types.JSONText
if err := c.q.GetDashboardCounts.Get(&out); err != nil {
return nil, echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorFetching", "name", "dashboard stats", "error", pqErrMsg(err)))
}
return out, nil
}