diff --git a/app/graphql/types/event_data_edge.rb b/app/graphql/types/event_data_edge.rb index 3d44e89c8..b38ab5018 100644 --- a/app/graphql/types/event_data_edge.rb +++ b/app/graphql/types/event_data_edge.rb @@ -10,29 +10,29 @@ class EventDataEdge < GraphQL::Relay::Edge def event_data @event_data ||= begin - Event.query(nil, subj_id: self.node[:id], obj_id: self.parent[:id]).results.first.to_h + Event.query(nil, subj_id: self.node.id, obj_id: self.parent.id).results.first.to_h end end def source_id - self.node[:id] + self.node.id end def target_id - self.parent[:id] + self.parent.id end def source - event_data[:source_id].underscore.camelcase(:lower) + event_data.source_id.underscore.camelcase(:lower) end # We are switching subj and obj, and thus need to change direction of relation type def relation_type - rt = event_data[:relation_type_id].underscore.camelcase(:lower) + rt = event_data.relation_type_id.underscore.camelcase(:lower) RELATION_TYPES.fetch(rt, rt) end def total - event_data[:total] + event_data.total end end diff --git a/app/graphql/types/event_data_edge_type.rb b/app/graphql/types/event_data_edge_type.rb index 734025813..dc6453aa1 100644 --- a/app/graphql/types/event_data_edge_type.rb +++ b/app/graphql/types/event_data_edge_type.rb @@ -3,9 +3,9 @@ class EventDataEdgeType < GraphQL::Types::Relay::BaseEdge node_type(EventDataType) - field :source_id, String, null: false, description: "The source ID of the event." - field :target_id, String, null: false, description: "The target ID of the event." - field :source, String, null: false, description: "Source for this event" - field :relation_type, String, null: false, description: "Relation type for this event." - field :total, Integer, null: false, description: "Total count for this event." + field :source_id, String, null: true, description: "The source ID of the event." + field :target_id, String, null: true, description: "The target ID of the event." + field :source, String, null: true, description: "Source for this event" + field :relation_type, String, null: true, description: "Relation type for this event." + field :total, Integer, null: true, description: "Total count for this event." end