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.25 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.24 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.23 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.22 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.21 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.20 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.18 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.17 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.16 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.15 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.14 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.13 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.12 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.11 app/models/renalware/clinical/delete_allergy.rb
renalware-core-2.0.9 app/models/renalware/clinical/delete_allergy.rb