Class: Ecoportal::API::GraphQL::Base::Page::DataField::ImageGallery

Inherits:
DataField
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/base/page/data_field/image_gallery.rb

Overview

Image gallery field. ★ WRITE PATH BROKEN (schema-invalid, live-verified 2026-08): ImageGalleryInput has no fileContainerIds — it takes images: [ImageInput], attaching via sourceId, which is an Enzyme::ImageReference::TempImage (a DIFFERENT upload pipeline than file containers). Fixing this needs its own design — see the DataField shape-asymmetry review project. The reader is equally stale: live responses carry images, not fileContainers.

Instance Method Summary collapse

Instance Method Details

#as_inputObject



20
21
22
23
24
# File 'lib/ecoportal/api/graphql/base/page/data_field/image_gallery.rb', line 20

def as_input
  return nil unless dirty?

  { imageGallery: { id: id, fileContainerIds: file_container_ids } }
end

#file_container_idsObject



12
13
14
# File 'lib/ecoportal/api/graphql/base/page/data_field/image_gallery.rb', line 12

def file_container_ids
  Array(fileContainers).map { |c| c.is_a?(Hash) ? c['id'] : c }.compact
end

#file_container_ids=(ids) ⇒ Object



16
17
18
# File 'lib/ecoportal/api/graphql/base/page/data_field/image_gallery.rb', line 16

def file_container_ids=(ids)
  doc['fileContainers'] = Array(ids).map { |id_val| { 'id' => id_val } }
end