Sha256: 69af13192ae7108e6cd83b19f737a642bf7db56f1043c94c4ff5103afdfc1ad8

Contents?: true

Size: 937 Bytes

Versions: 16

Compression:

Stored size: 937 Bytes

Contents

require_dependency "renalware/patients"
require_dependency "renalware/api"

module Renalware
  module API
    module V1
      module Medications
        class PrescriptionsController < TokenAuthenticatedApiController
          def index
            render locals: {
              patient: patient,
              prescriptions: current_prescriptions_presenter
            }
          end

          private

          def current_prescriptions_presenter
            CollectionPresenter.new(
              current_prescriptions,
              Renalware::Medications::PrescriptionPresenter
            )
          end

          def current_prescriptions
            Renalware::Medications::PrescriptionsQuery.new(
              relation: patient.prescriptions.current
            ).call
          end

          def patient
            Patient.find_by!(secure_id: params[:patient_id])
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.15 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.14 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.13 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.12 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.11 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.9 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.8 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.7 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.5 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.4 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.3 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.2 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.1 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.0 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb
renalware-core-2.0.0.pre.rc13 app/controllers/renalware/api/v1/medications/prescriptions_controller.rb