Skip to content

Commit

Permalink
Merge pull request #4416 from sanger/y24-099-tube-rack-banking-sequen…
Browse files Browse the repository at this point in the history
…cescape-api

Y24-099 scRNA - tube rack banking sequencescape api
  • Loading branch information
andrewsparkes authored Nov 27, 2024
2 parents 50f3509 + a1bf04a commit 0fbb091
Show file tree
Hide file tree
Showing 30 changed files with 1,743 additions and 18 deletions.
12 changes: 12 additions & 0 deletions app/controllers/api/v2/specific_tube_rack_creations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Api
module V2
# Provides a JSON API controller for Specific Tube Rack Creations
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
class SpecificTubeRackCreationsController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most the standard
# behaviour, and in many cases this file may be left empty.
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/api/v2/tube_rack_purposes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Api
module V2
# Provides a JSON API controller for tube purposes.
# Provides a JSON API controller for tube rack purposes.
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
class TubeRackPurposesController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most of the standard
Expand Down
7 changes: 6 additions & 1 deletion app/models/asset_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,24 @@ def destroy!
end

module Associations
# rubocop:disable Metrics/MethodLength
def self.included(base)
base.class_eval do
extend ClassMethods

has_dag_links link_class_name: 'AssetLink'
has_many :child_plates, through: :links_as_parent, source: :descendant, class_name: 'Plate'
has_many :child_tubes, through: :links_as_parent, source: :descendant, class_name: 'Tube'
has_many :child_plates, through: :links_as_parent, source: :descendant, class_name: 'Plate'
has_many :child_tube_racks, through: :links_as_parent, source: :descendant, class_name: 'TubeRack'
has_many :parent_tubes, through: :links_as_child, source: :ancestor, class_name: 'Tube'
has_many :parent_plates, through: :links_as_child, source: :ancestor, class_name: 'Plate'
has_many :parent_tube_racks, through: :links_as_child, source: :ancestor, class_name: 'TubeRack'
end
base.extend(ClassMethods)
end

# rubocop:enable Metrics/MethodLength

module ClassMethods
def has_one_as_child(name, scope) # rubocop:todo Metrics/MethodLength
plural_name = name.to_s.pluralize.to_sym
Expand Down
Loading

0 comments on commit 0fbb091

Please sign in to comment.