Sha256: 6a0bb9133231391c5995efe200da1da2e72ecff8aee1b0898b42fa7b5c8bb6fc

Contents?: true

Size: 928 Bytes

Versions: 62

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/events"
require "document/base"
require "document/embedded"
require "document/enum"

module Renalware
  module Events
    class Investigation < Event
      include Document::Base

      scope :transplant_donors, lambda{
        where("document ->> 'modality' = ?", "transplant_donor")
      }
      scope :transplant_recipients, lambda{
        where("document ->> 'modality' = ?", "transplant_recipient")
      }

      class Document < Document::Embedded
        attribute :modality,
                  ::Document::Enum,
                  enums: %i(transplant_donor transplant_recipient other)
        attribute :type, ::Document::Enum # See i18n for options
        attribute :result, String
        validates :modality, presence: true
        validates :type, presence: true
        validates :result, presence: true
      end
      has_document
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
renalware-core-2.0.11 app/models/renalware/events/investigation.rb
renalware-core-2.0.9 app/models/renalware/events/investigation.rb