Sha256: c66edd112c0736efff5737bbb7b0b7e029170744257743806595e775d02e0664

Contents?: true

Size: 505 Bytes

Versions: 95

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Clinical
    class DeleteAllergy
      def initialize(allergy, user)
        @allergy = allergy
        @user = user
      end

      def call
        Allergy.transaction do
          patient = allergy.patient
          allergy.destroy
          if patient.allergies.count == 0
            patient.update(allergy_status: :unrecorded, by: user)
          end
        end
      end

      private

      attr_reader :allergy, :user
    end
  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
renalware-core-2.0.46 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.45 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.44 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.43 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.42 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.41 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.40 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.39 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.38 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.37 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.36 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.35 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.34 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.33 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.32 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.31 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.30 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.28 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.27 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.26 app/models/renalware/clinical/delete_allergy.rb