Sha256: 421491e0335fdbacc7f1a83db7096d776809f3ad78ba3a515932ad4917ebaed9

Contents?: true

Size: 865 Bytes

Versions: 12

Compression:

Stored size: 865 Bytes

Contents

module Workarea
  module Api
    module Storefront
      class RecentViewsController < Api::Storefront::ApplicationController
        before_action :assert_current_metrics_id

        def show
          @recent_views = Workarea::Storefront::UserActivityViewModel.new(
            current_metrics
          )
        end

        def update
          product_ids = Array.wrap(params[:product_id])
          category_ids = Array.wrap(params[:category_id])
          search_ids = Array.wrap(params[:search])

          if current_metrics_id.present?
            Metrics::User.save_affinity(
              id: current_metrics_id,
              action: 'viewed',
              product_ids: product_ids,
              category_ids: category_ids,
              search_ids: search_ids
            )
          end

          head :ok
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.6 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.5.5 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.5 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.5.4 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.4 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.5.3 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.3 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.5.2 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.2 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.5.0 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.5.0 app/controllers/workarea/api/storefront/recent_views_controller.rb