lib/ecoportal/api/graphql/helpers/locations_tree.rb in ecoportal-api-graphql-0.3.7 vs lib/ecoportal/api/graphql/helpers/locations_tree.rb in ecoportal-api-graphql-0.3.8

- old
+ new

@@ -14,15 +14,22 @@ private def get_children(node_id, parents) (parents[node_id&.upcase] ||= []).each_with_object([]) do |child, results| + class_types = child.classifications || [] + class_ids = class_types.map(&:id) + class_names = class_types.map(&:name) + results << { - "id" => child.id, - "name" => child.name, - "weight" => child.weight, - "archived" => child.archived, - "archived_token" => child.archivedToken, + "id" => child.id, + "name" => child.name, + "weight" => child.weight, + "parent_id" => node_id, + "archived" => child.archived, + "archived_token" => child.archivedToken, + "classifications" => class_ids, + "classification_names" => class_names, "nodes" => get_children(child.id, parents).compact } end end end