module Ecoportal module API class GraphQL module Logic class Payload < Ecoportal::API::GraphQL::Base::Model class GenericItem def initialize(*_args, **_kargs) raise "Missuse error. You should define a item_class for a class that inherits from GraphqlPayload class." end end passthrough :clientMutationId class_resolver :item_class, GenericItem embeds_one :item, klass: :item_class embeds_one :errors, klass: Ecoportal::API::GraphQL::Error::ValidationErrors, nullable: true def success? !errors || errors.empty? end end end end end end