Class: Api::V5::LocationsController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Api::V5::LocationsController
- Defined in:
- app/controllers/api/v5/locations_controller.rb
Overview
typed: ignore frozen_string_literal: true
Constant Summary
Constants inherited from BaseController
BaseController::CACHE_NAMESPACE, BaseController::INTERNAL_SERVER_ERROR_MESSAGE, BaseController::ResponseSchema
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from LogrageCustomLogger
Methods included from ResponseCacheConcern
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/api/v5/locations_controller.rb', line 5 def index page = params.fetch(:page, {}) filter = Api::V5::LocationsFilter.new .init_default city_id = params[:city_id] filter.by_city_id(city_id) if city_id.present? filter.page_number(page[:number]).per_page(page[:size]) cache_key = "#{CACHE_NAMESPACE}:#{self.class}:#{I18n.locale}:#{RestaurantTag.locations_cache_key}:#{params[:sort]}#{city_id}" my_response_cache cache_key, :json, public: true do = {} filter.sort_by(params[:sort]) filter.as_json(serialization_context, minor_version_param, ).merge(success: true, message: nil) end set_status_header(true) end |