sanger/sequencescape

View on GitHub
app/api/model_extensions/submission.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
85%
# frozen_string_literal: true
# Included in {Submission}
# The intent of this file was to provide methods specific to the V1 API
module ModelExtensions::Submission
  def self.included(base)
    base.class_eval do
      scope :include_orders,
            lambda {
              includes(
                orders: {
                  study: :uuid_object,
                  project: :uuid_object,
                  assets: [:uuid_object, { aliquots: Io::Aliquot::PRELOADS }]
                }
              )
            }

      def order
        orders.first
      end
    end
  end
end