Delete organization endpoint added (#5601)
* Delete organization endpoint added * Parameters added in comment * Typo fix * Newline character removed
This commit is contained in:
parent
21357a4ae0
commit
6e20b504b1
|
@ -622,7 +622,8 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||||
m.Group("/orgs/:orgname", func() {
|
m.Group("/orgs/:orgname", func() {
|
||||||
m.Get("/repos", user.ListOrgRepos)
|
m.Get("/repos", user.ListOrgRepos)
|
||||||
m.Combo("").Get(org.Get).
|
m.Combo("").Get(org.Get).
|
||||||
Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit)
|
Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit).
|
||||||
|
Delete(reqToken(), reqOrgOwnership(), org.Delete)
|
||||||
m.Group("/members", func() {
|
m.Group("/members", func() {
|
||||||
m.Get("", org.ListMembers)
|
m.Get("", org.ListMembers)
|
||||||
m.Combo("/:username").Get(org.IsMember).
|
m.Combo("/:username").Get(org.IsMember).
|
||||||
|
|
|
@ -166,3 +166,26 @@ func Edit(ctx *context.APIContext, form api.EditOrgOption) {
|
||||||
|
|
||||||
ctx.JSON(200, convert.ToOrganization(org))
|
ctx.JSON(200, convert.ToOrganization(org))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Delete an organization
|
||||||
|
func Delete(ctx *context.APIContext) {
|
||||||
|
// swagger:operation DELETE /orgs/{org} organization orgDelete
|
||||||
|
// ---
|
||||||
|
// summary: Delete an organization
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - name: org
|
||||||
|
// in: path
|
||||||
|
// description: organization that is to be deleted
|
||||||
|
// type: string
|
||||||
|
// required: true
|
||||||
|
// responses:
|
||||||
|
// "204":
|
||||||
|
// "$ref": "#/responses/empty"
|
||||||
|
if err := models.DeleteOrganization(ctx.Org.Organization); err != nil {
|
||||||
|
ctx.Error(500, "DeleteOrganization", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Status(204)
|
||||||
|
}
|
||||||
|
|
|
@ -467,6 +467,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"delete": {
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"organization"
|
||||||
|
],
|
||||||
|
"summary": "Delete an organization",
|
||||||
|
"operationId": "orgDelete",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "organization that is to be deleted",
|
||||||
|
"name": "org",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"$ref": "#/responses/empty"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"patch": {
|
"patch": {
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
|
|
Loading…
Reference in New Issue