class MobileAppApi::V1::SearchController

Public Instance Methods

search_categories() click to toggle source

Method to get categories according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 47
def search_categories
  categories = Category.search(query: params[:query]).records
  render json: { status: 200, search_count: categories.total_count, categories: categories.records }
end
search_customers() click to toggle source

Method to get customers according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 37
def search_customers
  customers = Customer.search(query: params[:query]).records
  render json: {
    status: 200,
    search_count: customers.total_count,
    customers: customers.records.map(&:full_info)
  }
end
search_service_providers() click to toggle source

Method to search all service providers.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 5
def search_service_providers
  fixxperts = Fixxpert.search(query: params[:query]).records
  render json: { status: 200, search_count: fixxperts.total_count, service_providers: fixxperts.records.map(&:full_info), category_trades_subtrades: fixxperts.records.map(&:categories_trades_subtrades)}
end
search_subtrades() click to toggle source

Method to get subtrades according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 11
def search_subtrades
  subtrades = Subtrade.search(query: params[:query]).records
  render json: { status: 200, search_count: subtrades.total_count, subtrades: subtrades.records }
end
search_trades() click to toggle source

Method to get trades according to search parameters.

# File app/controllers/mobile_app_api/v1/search_controller.rb, line 53
def search_trades
  trades = Trade.search(query: params[:query]).records
  render json: { status: 200, search_count: trades.total_count, trades: trades.records }
end