Implement team deletion
This commit is contained in:
parent
40f7d7a0be
commit
8cf2a36fe1
1 changed files with 15 additions and 0 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
var ApiTeamsRouting = map[string]DispatchFunction{
|
var ApiTeamsRouting = map[string]DispatchFunction{
|
||||||
"GET": listTeam,
|
"GET": listTeam,
|
||||||
"POST": creationTeam,
|
"POST": creationTeam,
|
||||||
|
"DELETE": deletionTeam,
|
||||||
}
|
}
|
||||||
|
|
||||||
func listTeam(args []string, body []byte) (interface{}, error) {
|
func listTeam(args []string, body []byte) (interface{}, error) {
|
||||||
|
@ -58,3 +59,17 @@ func creationTeam(args []string, body []byte) (interface{}, error) {
|
||||||
return nil,nil
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in a new issue