Closed sergeyantonov1 closed 2 years ago
Added ability to trigger events in GraphQL resolvers.
Problem:
Case when you can use it:
Example of usage:
module Resolvers class PollItem < Resolvers::Base argument :id, Integer, required: true type Types::PollType, null: false private def fetch_data context[:poll] = current_user.received_polls.find(options[:id]) end def trigger_event TriggerEvent.new(event: "poll_opened", options: { poll_id: options[:id] }) end end end
# config/initializers/events.rb ActiveSupport::Notifications.subscribe "poll_opened" do |_name, _start, _finish, _id, payload| # do something end
None
While reviewing pull-request (especially when it's your pull-request), please make sure that:
.env.example
@DmitryBarskov by GraphQL rules you can use query for reading data, mutation for modify data. You can read it here:
Summary
Added ability to trigger events in GraphQL resolvers.
Problem:
Case when you can use it:
Example of usage:
How it works
Test plan
None
Review notes
While reviewing pull-request (especially when it's your pull-request), please make sure that:
.env.example
and added to HerokuDeploy notes
None
References
None