Sha256: 7cb3f8801eec51f40761b5fd7cf5bde26b3d65914d2bf4c1e92590a68fe8d55b

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

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

        def show
          if stale?(
            etag: user_activity,
            last_modified: user_activity.updated_at,
            public: true
          )
            @recent_views = Workarea::Storefront::UserActivityViewModel.new(
              user_activity
            )
          end
        end

        def update
          if params[:product_id].present?
            Recommendation::UserActivity.save_product(
              current_user_activity_id,
              params[:product_id]
            )
          end

          if params[:category_id].present?
            Recommendation::UserActivity.save_category(
              current_user_activity_id,
              params[:category_id]
            )
          end

          if params[:search].present?
            Recommendation::UserActivity.save_search(
              current_user_activity_id,
              params[:search]
            )
          end

          head :ok
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
workarea-api-4.4.7 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.4.7 app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-4.4.6 storefront/app/controllers/workarea/api/storefront/recent_views_controller.rb
workarea-api-storefront-4.4.6 app/controllers/workarea/api/storefront/recent_views_controller.rb