2015-03-06 16:29:26 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2015-03-08 11:17:56 +00:00
|
|
|
"github.com/fatih/structs"
|
2015-03-06 16:29:26 +00:00
|
|
|
"github.com/localhots/empact/db"
|
|
|
|
)
|
|
|
|
|
2015-03-08 11:17:56 +00:00
|
|
|
func statOrgTopHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 14:56:02 +00:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
top := db.StatOrgTop(req.login, structs.Map(stat))
|
2015-03-07 14:56:02 +00:00
|
|
|
req.respondWith(top)
|
2015-03-06 16:29:26 +00:00
|
|
|
}
|
|
|
|
|
2015-03-08 11:17:56 +00:00
|
|
|
func statOrgActivityHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 14:56:02 +00:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
activity := db.StatOrgActivity(req.login, structs.Map(stat))
|
2015-03-07 14:56:02 +00:00
|
|
|
req.respondWith(activity)
|
2015-03-06 16:29:26 +00:00
|
|
|
}
|
|
|
|
|
2015-03-08 11:17:56 +00:00
|
|
|
func statTeamTopHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 14:56:02 +00:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
top := db.StatTeamTop(req.login, structs.Map(stat))
|
2015-03-07 14:56:02 +00:00
|
|
|
req.respondWith(top)
|
2015-03-06 16:29:26 +00:00
|
|
|
}
|
|
|
|
|
2015-03-08 11:17:56 +00:00
|
|
|
func statTeamActivityHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 14:56:02 +00:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
activity := db.StatTeamActivity(req.login, structs.Map(stat))
|
2015-03-07 14:56:02 +00:00
|
|
|
req.respondWith(activity)
|
2015-03-06 16:29:26 +00:00
|
|
|
}
|
2015-03-08 14:35:25 +00:00
|
|
|
|
|
|
|
func statUserTopHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
top := db.StatUserTop(req.login, structs.Map(stat))
|
2015-03-08 14:35:25 +00:00
|
|
|
req.respondWith(top)
|
|
|
|
}
|
|
|
|
|
|
|
|
func statUserActivityHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
activity := db.StatUserActivity(req.login, structs.Map(stat))
|
2015-03-08 14:35:25 +00:00
|
|
|
req.respondWith(activity)
|
|
|
|
}
|
|
|
|
|
|
|
|
func statRepoTopHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
top := db.StatRepoTop(req.login, structs.Map(stat))
|
2015-03-08 14:35:25 +00:00
|
|
|
req.respondWith(top)
|
|
|
|
}
|
|
|
|
|
|
|
|
func statRepoActivityHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-22 13:25:18 +00:00
|
|
|
activity := db.StatRepoActivity(req.login, structs.Map(stat))
|
2015-03-08 14:35:25 +00:00
|
|
|
req.respondWith(activity)
|
|
|
|
}
|