Implement team deletion
This commit is contained in:
parent
40f7d7a0be
commit
8cf2a36fe1
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue