Implement team deletion

This commit is contained in:
nemunaire 2016-01-13 01:12:36 +01:00
parent 40f7d7a0be
commit 8cf2a36fe1
1 changed files with 15 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
var ApiTeamsRouting = map[string]DispatchFunction{
"GET": listTeam,
"POST": creationTeam,
"DELETE": deletionTeam,
}
func listTeam(args []string, body []byte) (interface{}, error) {
@ -58,3 +59,17 @@ func creationTeam(args []string, body []byte) (interface{}, error) {
return nil,nil
}
}
func deletionTeam(args []string, body []byte) (interface{}, error) {
if len(args) == 1 {
if tid, err := strconv.Atoi(string(args[0])); err != nil {
return nil, err
} else if team, err := GetTeam(tid); err != nil {
return nil, err
} else {
return team.Delete()
}
} else {
return nil, nil
}
}