8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/groovestack/base/graphql/subscriptions/trigger.rb', line 8
def self.trigger(subscription, args, event, kwargs)
triggered = false
::GraphQL::Schema.descendants.each do |schema|
subscription_type = schema.types['Subscription'] || schema.types['SubscriptionType']
next if subscription_type.blank?
next unless schema.get_fields(subscription_type).keys.include?(subscription.to_s)
triggered = true
schema.subscriptions.trigger(subscription, args, event, **kwargs)
end
puts 'app schema not defined' unless triggered
end
|