Sha256: 6c4df6b6aefe419defdf0bc815729be3ebb68a02d12f72d8caebc77d50c9e3b7
Contents?: true
Size: 979 Bytes
Versions: 10
Compression:
Stored size: 979 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/patients" require_dependency "renalware/api" module Renalware module API module V1 module Patients class PatientsController < TokenAuthenticatedAPIController include Concerns::Pageable def show patient = Patient.find_by!(local_patient_id: params[:id]) render locals: { patient: patient } end def index render locals: { patients: patients } end private def patients relation = last_patient_id.blank? ? Patient.none : Patient relation .where("id > ?", last_patient_id) .order(id: :asc) .page(page).per(per_page) end def last_patient_id params[:last_patient_id] end def per_page params[:per_page] || 100 end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems