Org stat endpoints & queries

This commit is contained in:
2015-03-06 23:29:26 +07:00
parent 7d38440126
commit 3e27fd11ae
6 changed files with 207 additions and 2 deletions
+5
View File
@@ -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() {
+32
View File
@@ -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)
}