Files
openfoodnetwork/app/serializers/api/admin/variant_override_serializer.rb
Maikel Linke a3ec3e74ae Hide stock level of on-demand inventory items
We changed to tracking stock of on-demand items to be able to place
backorders. This is mostly hidden in the app but was still visible on
the inventory page. Now we are hiding that here, too.
2025-01-09 10:06:04 +11:00

25 lines
538 B
Ruby

# frozen_string_literal: true
module Api
module Admin
class VariantOverrideSerializer < ActiveModel::Serializer
attributes :id, :hub_id, :variant_id, :sku, :price, :count_on_hand, :on_demand,
:default_stock, :resettable, :tag_list, :tags, :import_date
def count_on_hand
return if object.on_demand
object.count_on_hand
end
def tag_list
object.tag_list.join(",")
end
def tags
object.tag_list.map { |t| { text: t } }
end
end
end
end