Module: ModelExtensions::Request

Included in:
Request
Defined in:
app/api/model_extensions/request.rb

Overview

Included in Request The intent of this file was to provide methods specific to the V1 API

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

rubocop:todo Metrics/AbcSize


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/api/model_extensions/request.rb', line 5

def self.included(base) # rubocop:todo Metrics/AbcSize
  base.class_eval do
    scope :include_source_asset,
          -> { includes(asset: [:uuid_object, :barcodes, :scanned_into_lab_event, { aliquots: %i[sample tag] }]) }
    scope :include_target_asset,
          -> { includes(target_asset: [:uuid_object, :barcodes, { aliquots: %i[sample tag] }]) }

    scope :include_study, -> { includes(study: :uuid_object) }
    scope :include_project, -> { includes(project: :uuid_object) }
    scope :include_request_type, -> { includes(:request_type) }
    scope :include_submission, -> { includes(submission: :uuid_object) }
  end
end