Org stat endpoints & queries
This commit is contained in:
@@ -31,6 +31,11 @@ func init() {
|
||||
http.HandleFunc("/api/orgs", apiOrgsHandler)
|
||||
http.HandleFunc("/api/teams", apiTeamsHandler)
|
||||
http.HandleFunc("/api/repos", apiReposHandler)
|
||||
http.HandleFunc("/api/stat/repos/top", statOrgReposTop)
|
||||
http.HandleFunc("/api/stat/repos/activity", statOrgReposActivity)
|
||||
http.HandleFunc("/api/stat/teams/top", statOrgTeamsTop)
|
||||
http.HandleFunc("/api/stat/teams/activity", statOrgTeamsActivity)
|
||||
http.HandleFunc("/api/stat/users/top", statOrgUsersTop)
|
||||
}
|
||||
|
||||
func Start() {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/localhots/empact/db"
|
||||
)
|
||||
|
||||
func statOrgReposTop(w http.ResponseWriter, r *http.Request) {
|
||||
top := db.StatOrgReposTop(db.ParseRequest(r))
|
||||
respondWith(w, top)
|
||||
}
|
||||
|
||||
func statOrgReposActivity(w http.ResponseWriter, r *http.Request) {
|
||||
activity := db.StatOrgReposActivity(db.ParseRequest(r))
|
||||
respondWith(w, activity)
|
||||
}
|
||||
|
||||
func statOrgTeamsTop(w http.ResponseWriter, r *http.Request) {
|
||||
top := db.StatOrgTeamsTop(db.ParseRequest(r))
|
||||
respondWith(w, top)
|
||||
}
|
||||
|
||||
func statOrgTeamsActivity(w http.ResponseWriter, r *http.Request) {
|
||||
activity := db.StatOrgTeamsActivity(db.ParseRequest(r))
|
||||
respondWith(w, activity)
|
||||
}
|
||||
|
||||
func statOrgUsersTop(w http.ResponseWriter, r *http.Request) {
|
||||
top := db.StatOrgUsersTop(db.ParseRequest(r))
|
||||
respondWith(w, top)
|
||||
}
|
||||
Reference in New Issue
Block a user