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.90 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.89 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.88 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.87 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.86 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.85 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.84 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.83 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.82 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.81 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.80 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.79 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.78 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.77 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.76 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.75 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.74 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.73 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.72 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.71 app/models/renalware/clinical/delete_allergy.rb