Remove team's initial_name, replaced by their ID

This commit is contained in:
nemunaire 2018-01-21 14:07:44 +01:00
parent 191c89f7ad
commit e083da2f72
9 changed files with 26 additions and 65 deletions

View file

@ -81,11 +81,7 @@ func apiHandler(f DispatchFunction) func(http.ResponseWriter, *http.Request, htt
func teamPublicHandler(f func(*fic.Team,[]byte) (interface{}, error)) func (httprouter.Params,[]byte) (interface{}, error) {
return func (ps httprouter.Params, body []byte) (interface{}, error) {
if tid, err := strconv.Atoi(string(ps.ByName("tid"))); err != nil {
if team, err := fic.GetTeamByInitialName(ps.ByName("tid")); err != nil {
return nil, err
} else {
return f(&team, body)
}
return nil, err
} else if tid == 0 {
return f(nil, body)
} else if team, err := fic.GetTeam(tid); err != nil {
@ -99,11 +95,7 @@ func teamPublicHandler(f func(*fic.Team,[]byte) (interface{}, error)) func (http
func teamHandler(f func(fic.Team,[]byte) (interface{}, error)) func (httprouter.Params,[]byte) (interface{}, error) {
return func (ps httprouter.Params, body []byte) (interface{}, error) {
if tid, err := strconv.Atoi(string(ps.ByName("tid"))); err != nil {
if team, err := fic.GetTeamByInitialName(ps.ByName("tid")); err != nil {
return nil, err
} else {
return f(team, body)
}
return nil, err
} else if team, err := fic.GetTeam(tid); err != nil {
return nil, err
} else {