Sha256: 77daf7827468162e36e124fe111b66e40d9ec7bc398100b2baf4318115c1ae07
Contents?: true
Size: 1.55 KB
Versions: 5
Compression:
Stored size: 1.55 KB
Contents
module MnoEnterprise class Jpi::V1::Admin::OrganizationsController < Jpi::V1::Admin::BaseResourceController # GET /mnoe/jpi/v1/admin/organizations def index if params[:terms] # Search mode @organizations = [] JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]) } response.headers['X-Total-Count'] = @organizations.count else # Index mode @organizations = MnoEnterprise::Organization @organizations = @organizations.limit(params[:limit]) if params[:limit] @organizations = @organizations.skip(params[:offset]) if params[:offset] @organizations = @organizations.order_by(params[:order_by]) if params[:order_by] @organizations = @organizations.where(params[:where]) if params[:where] @organizations = @organizations.all response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count] end end # GET /mnoe/jpi/v1/admin/organizations/1 def show @organization = MnoEnterprise::Organization.find(params[:id]) @organization_active_apps = @organization.app_instances.select { |app| app.status == "running" } end # GET /mnoe/jpi/v1/admin/organizations/in_arrears def in_arrears @arrears = MnoEnterprise::ArrearsSituation.all end # GET /mnoe/jpi/v1/admin/organizations/count def count organizations_count = MnoEnterprise::Tenant.get('tenant').organizations_count render json: {count: organizations_count } end end end
Version data entries
5 entries across 5 versions & 1 rubygems