From dec68e8728c4603ac9ec28e06c89b451caf4b1bf Mon Sep 17 00:00:00 2001 From: Chom Panha <92453740+panhachom@users.noreply.github.com> Date: Fri, 22 Nov 2024 21:37:03 +0700 Subject: [PATCH] close #2074 remove api cache (#2075) --- .../waiting_room_authorization.rb | 6 ++---- .../product_serializer_decorator.rb | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/spree_cm_commissioner/waiting_room_authorization.rb b/app/controllers/concerns/spree_cm_commissioner/waiting_room_authorization.rb index 9b0cb0e74..a4dfa921e 100644 --- a/app/controllers/concerns/spree_cm_commissioner/waiting_room_authorization.rb +++ b/app/controllers/concerns/spree_cm_commissioner/waiting_room_authorization.rb @@ -19,10 +19,8 @@ def ensure_waiting_room_session_token end def required_waiting_room_session? - apis = [ - '/api/v2/storefront/products', - '/api/v2/storefront/taxons' - ] + # temporary disable + apis = [] apis.any? { |prefix| request.path.start_with?(prefix) } end diff --git a/app/serializers/spree/v2/storefront/product_serializer_decorator.rb b/app/serializers/spree/v2/storefront/product_serializer_decorator.rb index 18e71c50e..20bb69b98 100644 --- a/app/serializers/spree/v2/storefront/product_serializer_decorator.rb +++ b/app/serializers/spree/v2/storefront/product_serializer_decorator.rb @@ -20,6 +20,26 @@ def self.prepended(base) base.attribute :purchasable_on_web do |product| product.purchasable_on == 'web' || product.purchasable_on == 'both' end + + base.attribute :purchasable do |product| + value = product.purchasable? + [true, false].include?(value) ? value : nil + end + + base.attribute :in_stock do |product| + value = product.in_stock? + [true, false].include?(value) ? value : nil + end + + base.attribute :backorderable do |product| + value = product.backorderable? + [true, false].include?(value) ? value : nil + end + + base.attribute :available do |product| + value = product.available? + [true, false].include?(value) ? value : nil + end end end end