Skip to content

Commit

Permalink
Add submission_pools to v2 plates
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjmchattie committed Nov 8, 2024
1 parent 0c2522b commit db696ea
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/controllers/api/v2/submission_pools_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 SubmissionPools
# See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation
class SubmissionPoolsController < JSONAPI::ResourceController
# By default JSONAPI::ResourceController provides most the standard
# behaviour, and in many cases this file may be left empty.
end
end
end
1 change: 1 addition & 0 deletions app/resources/api/v2/plate_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class PlateResource < BaseResource
default_includes :uuid_object, :barcodes, :plate_purpose, :transfer_requests

# Associations:
has_many :submission_pools, readonly: true
has_many :wells, write_once: true

# Attributes
Expand Down
34 changes: 34 additions & 0 deletions app/resources/api/v2/submission_pool_resource.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

module Api
module V2
# Provides a JSON:API representation of a {SubmissionPool}.
# SubmissionPools are designed to view submissions in the context of a particular labware.
#
# @example GET request for all SubmissionPool resources
# GET /api/v2/submission_pools/
#
# @example GET request for a SubmissionPool with ID 123
# GET /api/v2/submission_pools/123/
#
# @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests.
# @note Access this resource via the `/api/v2/submission_pools/` endpoint.
#
# Provides a JSON:API representation of {SubmissionPool}.
#
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation
# of the JSON:API standard.
class SubmissionPoolResource < BaseResource
immutable

# @!attribute [w] plates_in_submission
# @return [Integer] The number of plates in the submission pool.
attribute :plates_in_submission, readonly: true

# @!attribute [r] tag_layout_templates
# @return [Array<TagLayoutTemplateResource>] The tag layout templates for this submission pool.
has_many :tag_layout_templates, readonly: true
end
end
end
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
jsonapi_resources :specific_tube_creations, except: %i[update]
jsonapi_resources :state_changes, except: %i[update]
jsonapi_resources :studies
jsonapi_resources :submission_pools
jsonapi_resources :submission_templates
jsonapi_resources :submissions
jsonapi_resources :tag_group_adapter_types
Expand Down

0 comments on commit db696ea

Please sign in to comment.