Module: Ecoportal::API::GraphQL::Input::WorkflowCommand::AddViewableField

Defined in:
lib/ecoportal/api/graphql/input/workflow_command/add_viewable_field.rb

Overview

WorkflowAddViewableFieldInput — adds a person-schema field to the list of fields shown on a People data field ("viewable fields").

★ This command exists BECAUSE the 20260725 schema drift REMOVED WorkflowEditFieldConfigurationPeopleInput.addViewableFields: [String!]. Viewable fields moved from an array on the people field-config to three dedicated commands (add/move/remove), which also bought them ordering (anchorId + anchorPosition) that the old flat array could not express. Until these were wired, viewable-field management was simply impossible through this gem.

Constant Summary collapse

SCHEMA_VERSION =
'20260725'.freeze
VALID_KEYS =
%i[
  dataFieldId schemaFieldId schemaFieldType anchorId anchorPosition
].freeze
ANCHOR_POSITIONS =

AnchorPositionEnum

%w[BEFORE AFTER].freeze

Class Method Summary collapse

Class Method Details

.build(data_field_id:, schema_field_id:, **kwargs) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/ecoportal/api/graphql/input/workflow_command/add_viewable_field.rb', line 23

def self.build(data_field_id:, schema_field_id:, **kwargs)
  validate_anchor!(kwargs[:anchorPosition])

  {
    dataFieldId:   data_field_id,
    schemaFieldId: schema_field_id
  }.merge(kwargs.slice(*(VALID_KEYS - %i[dataFieldId schemaFieldId])).compact)
end