module Ecoportal module API class GraphQL module Query class Actions < Ecoportal::API::GraphQL::Base::QueryConnection class_resolver :item_class, Ecoportal::API::GraphQL::Model::Action class_resolver :connection_class, Ecoportal::API::GraphQL::Connection::Action def query(path: default_base_path, **kargs, &block) path ||= default_base_path request(*path, "actions") do graphql_query(**kargs, &basic_block(&block)) end end def default_base_path ["currentOrganization"] end private def basic_block(&block) connection_block = block || default_connection_block Proc.new { query(searchConf: :Search, after: :string, before: :string, first: :int, last: :int) { currentOrganization { actions( searchConf: :searchConf, after: :after, before: :before, first: :first, last: :last, &connection_block ) } } } end def default_connection_block Proc.new { totalCount pageInfo { endCursor } nodes { id altId actionCategory { name value } standaloneAction status relativeStatus archived tags name description assignedTo { id name email } createdAt { dateTime timeZone } dueDate { dateTime timeZone } completedAt { dateTime timeZone } completer { name email } linkedResources { id page { name mouldCounter } } } } end end end end end end