Sha256: 05e82f397819dc51a1eca48f5a98e8c8ff3ab0ddf907702a2aa6dbe4f0a7e141

Contents?: true

Size: 974 Bytes

Versions: 24

Compression:

Stored size: 974 Bytes

Contents

require_dependency "renalware/letters"

module Renalware
  module Letters
    class ApprovedLettersController < Letters::BaseController
      before_action :load_patient

      def create
        letter = @patient.letters.pending_review.find(params[:letter_id])

        # See config.broadcast_subscription_map for ApproveLetter event subscribers
        # We use an event subscription pattern to drive the delivery of letters at this point
        # rather than hard-wiring in a call to DeliverLetter.call etc. This is because letter
        # delivery is hospital-specific, and each might want to plumb in different or many classes
        # to handle different aspects of letter processing - not just delivery but also EPR etc.
        ApproveLetter
          .build(letter)
          .broadcasting_to_configured_subscribers
          .call(by: current_user)

        redirect_to patient_clinical_summary_path(@patient), notice: t(".success")
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.15 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.14 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.13 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.12 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.11 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.9 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.8 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.7 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.5 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.4 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.3 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.2 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.1 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0.pre.rc13 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0.pre.rc11 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0.pre.rc10 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0.pre.rc9 app/controllers/renalware/letters/approved_letters_controller.rb
renalware-core-2.0.0.pre.rc8 app/controllers/renalware/letters/approved_letters_controller.rb