Class: Ecoportal::API::GraphQL::Logic::Input
- Inherits:
-
Logic::BaseModel
- Object
- Logic::BaseModel
- Ecoportal::API::GraphQL::Logic::Input
- Defined in:
- lib/ecoportal/api/graphql/logic/input.rb
Direct Known Subclasses
Input::Action::Archive, Input::ContractorEntity::Destroy, Input::DeltaInput, Input::LocationStructure::ApplyCommands, Input::LocationStructure::Draft::AddCommands, Input::LocationStructure::Draft::Create, Input::LocationStructure::Draft::Delete, Input::LocationStructure::Draft::DropBadCommands, Input::LocationStructure::Draft::Publish, Input::Page, Input::Page::Archive, Input::Page::BuildFromTemplate, Input::Page::CreateDraft, Input::Page::CreateFromTemplate, Input::Page::DeleteDraft, Input::Page::PublishDraft, Input::Page::ReviewTask, Input::Page::Unarchive, Input::Page::Update, Input::PresetView, Input::PresetView::Create, Input::PresetView::Permission, Input::PresetView::Update, Input::Register, Input::Register::Create
Class Method Summary collapse
-
.from_model(model, client_mutation_id: '') ⇒ Hash?
Builds a mutation input hash from a model's diff.
Class Method Details
.from_model(model, client_mutation_id: '') ⇒ Hash?
Builds a mutation input hash from a model's diff. Subclasses override this to reshape fields (e.g. array → IdDiffInput).
13 14 15 16 17 18 19 20 |
# File 'lib/ecoportal/api/graphql/logic/input.rb', line 13 def from_model(model, client_mutation_id: '') diff = model.as_update return nil if diff.nil? diff[:patchVer] = model.patchVer if model.respond_to?(:patchVer) && !model.patchVer.nil? diff[:clientMutationId] = client_mutation_id unless client_mutation_id.to_s.empty? diff end |