First release of open core
This commit is contained in:
17
pkg/analytics/analytics.go
Normal file
17
pkg/analytics/analytics.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package analytics
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func (h *Handler) HandleGetAnalyticsSummary(w http.ResponseWriter, r *http.Request) {
|
||||
summary, err := h.Store.GetAnalyticsSummary(r.Context())
|
||||
if err != nil {
|
||||
http.Error(w, "Failed to generate analytics", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(summary)
|
||||
}
|
||||
Reference in New Issue
Block a user