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.77 app/models/renalware/events/investigation.rb
renalware-core-2.0.76 app/models/renalware/events/investigation.rb
renalware-core-2.0.75 app/models/renalware/events/investigation.rb
renalware-core-2.0.74 app/models/renalware/events/investigation.rb
renalware-core-2.0.73 app/models/renalware/events/investigation.rb
renalware-core-2.0.72 app/models/renalware/events/investigation.rb
renalware-core-2.0.71 app/models/renalware/events/investigation.rb
renalware-core-2.0.70 app/models/renalware/events/investigation.rb
renalware-core-2.0.69 app/models/renalware/events/investigation.rb
renalware-core-2.0.68 app/models/renalware/events/investigation.rb
renalware-core-2.0.67 app/models/renalware/events/investigation.rb
renalware-core-2.0.64 app/models/renalware/events/investigation.rb
renalware-core-2.0.63 app/models/renalware/events/investigation.rb
renalware-core-2.0.62 app/models/renalware/events/investigation.rb
renalware-core-2.0.61 app/models/renalware/events/investigation.rb
renalware-core-2.0.60 app/models/renalware/events/investigation.rb
renalware-core-2.0.58 app/models/renalware/events/investigation.rb
renalware-core-2.0.57 app/models/renalware/events/investigation.rb
renalware-core-2.0.56 app/models/renalware/events/investigation.rb
renalware-core-2.0.55 app/models/renalware/events/investigation.rb