module Ecoportal module API class GraphQL module Base class Model < Ecoportal::API::Common::Content::DoubleModel include Ecoportal::API::Common::GraphQL::ClassHelpers #include GraphModel::HashKeys class << self attr_accessor :client def as_input(hash, clientMutationId: "") hash_input = hash.merge(clientMutationId: clientMutationId) Ecoportal::API::Common::GraphQL::HashHelpers.remove_nil_keys_deep(hash_input, target: :id) end end def as_update(ref = :last, ignore: [], sym_keys: false) new_doc = as_json ref_doc = ref == :total ? initial_doc : original_doc Ecoportal::API::Common::HashDiff.diff(new_doc, ref_doc, ignore: ignore).yield_self do |out| next out unless sym_keys Ecoportal::API::Common::GraphQL::HashHelpers.keys_to_sym_deep(out) end end def as_input(clientMutationId: "") self.class.as_input(as_update(sym_keys: true), clientMutationId: clientMutationId) end end end end end end