refactor quota settings

This commit is contained in:
woodsaj
2015-09-11 01:47:33 +08:00
parent 555cbeffa5
commit 852f9bd277
9 changed files with 59 additions and 43 deletions

View File

@@ -16,6 +16,17 @@ func GetOrgQuotas(c *middleware.Context) Response {
return Json(200, query.Result)
}
// allow users to query the quotas of their own org.
func GetQuotas(c *middleware.Context) Response {
query := m.GetQuotasQuery{OrgId: c.OrgId}
if err := bus.Dispatch(&query); err != nil {
return ApiError(500, "Failed to get quotas", err)
}
return Json(200, query.Result)
}
func UpdateOrgQuota(c *middleware.Context, cmd m.UpdateQuotaCmd) Response {
cmd.OrgId = c.ParamsInt64(":orgId")
cmd.Target = m.QuotaTarget(c.Params(":target"))