2015-03-05 22:25:26 +07:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/localhots/empact/db"
|
|
|
|
)
|
|
|
|
|
2015-03-06 18:18:15 +07:00
|
|
|
func apiOrgsHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 21:56:02 +07:00
|
|
|
req, _ := parseRequest(w, r)
|
|
|
|
orgs := db.UserOrgs(req.login)
|
|
|
|
req.respondWith(orgs)
|
2015-03-06 17:56:46 +07:00
|
|
|
}
|
|
|
|
|
2015-03-06 18:18:15 +07:00
|
|
|
func apiTeamsHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 21:56:02 +07:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-08 18:17:56 +07:00
|
|
|
teams := db.OrgTeams(stat.Org)
|
2015-03-07 21:56:02 +07:00
|
|
|
req.respondWith(teams)
|
2015-03-05 22:25:26 +07:00
|
|
|
}
|
2015-03-06 18:18:15 +07:00
|
|
|
|
2015-03-15 00:34:37 +07:00
|
|
|
func apiUsersHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
req, stat := parseRequest(w, r)
|
|
|
|
users := db.OrgUsers(stat.Org)
|
|
|
|
req.respondWith(users)
|
|
|
|
}
|
|
|
|
|
2015-03-06 18:18:15 +07:00
|
|
|
func apiReposHandler(w http.ResponseWriter, r *http.Request) {
|
2015-03-07 21:56:02 +07:00
|
|
|
req, stat := parseRequest(w, r)
|
2015-03-08 18:17:56 +07:00
|
|
|
repos := db.OrgRepos(stat.Org)
|
2015-03-07 21:56:02 +07:00
|
|
|
req.respondWith(repos)
|
2015-03-06 18:18:15 +07:00
|
|
|
}
|