2022-07-13 15:06:46 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-09-20 15:30:44 +02:00
|
|
|
json.extract! @products, :page, :total_pages, :page_size, :total_count
|
|
|
|
json.data @products[:data] do |product|
|
2022-08-16 18:53:11 +02:00
|
|
|
json.extract! product, :id, :name, :slug, :sku, :is_active, :product_category_id, :quantity_min, :stock, :machine_ids,
|
|
|
|
:low_stock_threshold
|
|
|
|
json.amount product.amount / 100.0 if product.amount.present?
|
|
|
|
json.product_images_attributes product.product_images do |f|
|
|
|
|
json.id f.id
|
|
|
|
json.attachment_name f.attachment_identifier
|
|
|
|
json.attachment_url f.attachment_url
|
2022-09-27 12:20:48 +02:00
|
|
|
json.thumb_attachment_url f.attachment.thumb.url
|
2022-08-16 18:53:11 +02:00
|
|
|
json.is_main f.is_main
|
|
|
|
end
|
2022-07-13 15:06:46 +02:00
|
|
|
end
|