Sha256: 3730c0bf542d5090bfaef4c7eb3aa962e3f1682dac79293e1b4a26d45d1ba6de
Contents?: true
Size: 986 Bytes
Versions: 16
Compression:
Stored size: 986 Bytes
Contents
module Marty module Notifications module Create extend Delorean::Functions delorean_fn :call do |event_type:, text:| notification, deliveries = ActiveRecord::Base.transaction do notification = ::Marty::Notifications::Notification.create!( event_type: event_type, text: text, state: :pending ) # FIXME: We should consider processing deliveries in the background deliveries = ::Marty::Notifications::CreateDeliveries.call( notification: notification ) [notification, deliveries] end deliveries.each do |delivery| ::Marty::Notifications::ProcessDelivery.call( delivery: delivery ) end notification.set_processed! { id: notification.id, event_type: event_type, text: text, state: notification.state, } end end end end
Version data entries
16 entries across 16 versions & 1 rubygems