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.33 app/models/renalware/events/investigation.rb
renalware-core-2.0.32 app/models/renalware/events/investigation.rb
renalware-core-2.0.31 app/models/renalware/events/investigation.rb
renalware-core-2.0.30 app/models/renalware/events/investigation.rb
renalware-core-2.0.28 app/models/renalware/events/investigation.rb
renalware-core-2.0.27 app/models/renalware/events/investigation.rb
renalware-core-2.0.26 app/models/renalware/events/investigation.rb
renalware-core-2.0.25 app/models/renalware/events/investigation.rb
renalware-core-2.0.24 app/models/renalware/events/investigation.rb
renalware-core-2.0.23 app/models/renalware/events/investigation.rb
renalware-core-2.0.22 app/models/renalware/events/investigation.rb
renalware-core-2.0.21 app/models/renalware/events/investigation.rb
renalware-core-2.0.20 app/models/renalware/events/investigation.rb
renalware-core-2.0.18 app/models/renalware/events/investigation.rb
renalware-core-2.0.17 app/models/renalware/events/investigation.rb
renalware-core-2.0.16 app/models/renalware/events/investigation.rb
renalware-core-2.0.15 app/models/renalware/events/investigation.rb
renalware-core-2.0.14 app/models/renalware/events/investigation.rb
renalware-core-2.0.13 app/models/renalware/events/investigation.rb
renalware-core-2.0.12 app/models/renalware/events/investigation.rb