Add GET /analytics/old endpoint for v4 (#6666)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ef9326bcbb
Коммит
5627f3fd1d
@@ -37,6 +37,8 @@ func InitSystem() {
|
||||
|
||||
BaseRoutes.ApiRoot.Handle("/logs", ApiSessionRequired(getLogs)).Methods("GET")
|
||||
BaseRoutes.ApiRoot.Handle("/logs", ApiSessionRequired(postLog)).Methods("POST")
|
||||
|
||||
BaseRoutes.ApiRoot.Handle("/analytics/old", ApiSessionRequired(getAnalytics)).Methods("GET")
|
||||
}
|
||||
|
||||
func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
@@ -336,3 +338,30 @@ func removeLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.LogAudit("success")
|
||||
ReturnStatusOK(w)
|
||||
}
|
||||
|
||||
func getAnalytics(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
name := r.URL.Query().Get("name")
|
||||
teamId := r.URL.Query().Get("team_id")
|
||||
|
||||
if name == "" {
|
||||
name = "standard"
|
||||
}
|
||||
|
||||
if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
|
||||
c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
|
||||
return
|
||||
}
|
||||
|
||||
rows, err := app.GetAnalytics(name, teamId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
if rows == nil {
|
||||
c.SetInvalidParam("name")
|
||||
return
|
||||
}
|
||||
|
||||
w.Write([]byte(rows.ToJson()))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user