Class: Api::Partner::V1::ChannelsController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Api::Partner::V1::ChannelsController
- Defined in:
- app/controllers/api/partner/v1/channels_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
#default_restaurant, #identity_cache_memoization, #render_unauthorize_action, #restaurants, #set_options
Methods included from LogrageCustomLogger
Methods included from ControllerHelpers
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Methods included from ResponseCacheConcern
Instance Method Details
#index ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/api/partner/v1/channels_controller.rb', line 8 def index # Use aggressive caching for optimal performance following existing best practices # Filter channels that should show in owner dashboard using the existing tagging system channels_scope = Channel.tagged_with(Channel::SHOW_IN_OWNER_DASHBOARD) ordered_scope = channels_scope.order(:name) cache_key = "#{self.class}:index:#{channels_scope.cache_key}:#{I18n.locale}" channels_data = Rails.cache.fetch(cache_key, expires_in: CACHEFLOW.generate_expiry) do ::Api::Partner::ChannelSerializer.new(ordered_scope).as_json end render json: channels_data end |