Sha256: 43596f6c6b5c0ff48cd919239ff669f718e930910328db09201cede2439cfd1a
Contents?: true
Size: 608 Bytes
Versions: 35
Compression:
Stored size: 608 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/patient" module Renalware module Patients class IdempotentCreatePatient attr_reader :params def initialize(user) @user = user end # TODO: Support different local_patient_id columns def call(params) patient_params = params.fetch(:patient).merge(by: @user) local_patient_id = patient_params.fetch(:local_patient_id) ::Renalware::Patient.create_with(patient_params) .find_or_create_by!(local_patient_id: local_patient_id) end end end end
Version data entries
35 entries across 35 versions & 1 rubygems