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.111 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.110 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.109 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.108 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.106 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.105 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.104 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.103 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.102 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.101 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.100 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.99 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.98 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.97 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.96 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.95 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.94 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.93 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.92 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.91 app/models/renalware/clinical/delete_allergy.rb