rename Context to ReqContext

This commit is contained in:
Dan Cech
2018-03-07 11:54:50 -05:00
parent 338655dd37
commit c0ecdee375
63 changed files with 241 additions and 241 deletions
+10 -10
View File
@@ -10,17 +10,17 @@ import (
)
// GET /api/org
func GetOrgCurrent(c *m.Context) Response {
func GetOrgCurrent(c *m.ReqContext) Response {
return getOrgHelper(c.OrgId)
}
// GET /api/orgs/:orgId
func GetOrgById(c *m.Context) Response {
func GetOrgById(c *m.ReqContext) Response {
return getOrgHelper(c.ParamsInt64(":orgId"))
}
// Get /api/orgs/name/:name
func GetOrgByName(c *m.Context) Response {
func GetOrgByName(c *m.ReqContext) Response {
query := m.GetOrgByNameQuery{Name: c.Params(":name")}
if err := bus.Dispatch(&query); err != nil {
if err == m.ErrOrgNotFound {
@@ -75,7 +75,7 @@ func getOrgHelper(orgId int64) Response {
}
// POST /api/orgs
func CreateOrg(c *m.Context, cmd m.CreateOrgCommand) Response {
func CreateOrg(c *m.ReqContext, cmd m.CreateOrgCommand) Response {
if !c.IsSignedIn || (!setting.AllowUserOrgCreate && !c.IsGrafanaAdmin) {
return ApiError(403, "Access denied", nil)
}
@@ -97,12 +97,12 @@ func CreateOrg(c *m.Context, cmd m.CreateOrgCommand) Response {
}
// PUT /api/org
func UpdateOrgCurrent(c *m.Context, form dtos.UpdateOrgForm) Response {
func UpdateOrgCurrent(c *m.ReqContext, form dtos.UpdateOrgForm) Response {
return updateOrgHelper(form, c.OrgId)
}
// PUT /api/orgs/:orgId
func UpdateOrg(c *m.Context, form dtos.UpdateOrgForm) Response {
func UpdateOrg(c *m.ReqContext, form dtos.UpdateOrgForm) Response {
return updateOrgHelper(form, c.ParamsInt64(":orgId"))
}
@@ -119,12 +119,12 @@ func updateOrgHelper(form dtos.UpdateOrgForm, orgId int64) Response {
}
// PUT /api/org/address
func UpdateOrgAddressCurrent(c *m.Context, form dtos.UpdateOrgAddressForm) Response {
func UpdateOrgAddressCurrent(c *m.ReqContext, form dtos.UpdateOrgAddressForm) Response {
return updateOrgAddressHelper(form, c.OrgId)
}
// PUT /api/orgs/:orgId/address
func UpdateOrgAddress(c *m.Context, form dtos.UpdateOrgAddressForm) Response {
func UpdateOrgAddress(c *m.ReqContext, form dtos.UpdateOrgAddressForm) Response {
return updateOrgAddressHelper(form, c.ParamsInt64(":orgId"))
}
@@ -149,7 +149,7 @@ func updateOrgAddressHelper(form dtos.UpdateOrgAddressForm, orgId int64) Respons
}
// GET /api/orgs/:orgId
func DeleteOrgById(c *m.Context) Response {
func DeleteOrgById(c *m.ReqContext) Response {
if err := bus.Dispatch(&m.DeleteOrgCommand{Id: c.ParamsInt64(":orgId")}); err != nil {
if err == m.ErrOrgNotFound {
return ApiError(404, "Failed to delete organization. ID not found", nil)
@@ -159,7 +159,7 @@ func DeleteOrgById(c *m.Context) Response {
return ApiSuccess("Organization deleted")
}
func SearchOrgs(c *m.Context) Response {
func SearchOrgs(c *m.ReqContext) Response {
query := m.SearchOrgsQuery{
Query: c.Query("query"),
Name: c.Query("name"),