summaryrefslogtreecommitdiff
path: root/app/controllers/v1/company_licenses_controller.rb
blob: 3b4850ff71c43dc5e6d6f229367b08fbaeee44ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class V1::CompanyLicensesController < ApplicationController
  before_filter :load_company

  def index
    @active_licenses = @company.filter_licenses_using(search_filters)
    render json: @active_licenses
  end

  private

  def search_filters
    { status: LicenseStatus.find_match(params[:status]), township: params[:township] }
  end

  def load_company
    @company = Company.find(params[:company_id])
  end
end