Class: Dscf::Marketplace::DashboardController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dscf/marketplace/dashboard_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#bypass_permissions_for_demo?, #pundit_user

Instance Method Details

#summaryObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/dscf/marketplace/dashboard_controller.rb', line 4

def summary
  authorize :dashboard, :summary?

  render_success(
    "dashboard.success.summary",
    data: {
      total_listings: Dscf::Marketplace::Listing.count,
      total_suppliers: Dscf::Marketplace::Supplier.count,
      total_businesses: Dscf::Core::Business.count,
      total_products: Dscf::Marketplace::Product.count,
      pending_supplier_products: Dscf::Marketplace::SupplierProduct.inactive.count,
      active_listings: Dscf::Marketplace::Listing.active.count,
      promoted_listings: Dscf::Marketplace::Listing.orchestrator_promoted.count
    }
  )
end