mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 04:47:22 +08:00
Added results endpoint
This commit is contained in:
parent
30c4fac2ae
commit
837fbaa35f
3 changed files with 12 additions and 6 deletions
|
@ -14,12 +14,15 @@ module Api
|
||||||
.page(params.dig(:page, :number))
|
.page(params.dig(:page, :number))
|
||||||
.per(params.dig(:page, :size))
|
.per(params.dig(:page, :size))
|
||||||
|
|
||||||
render jsonapi: results,
|
render jsonapi: results, include: %w(
|
||||||
each_serializer: ResultSerializer
|
result_table result_text result_asset
|
||||||
|
), each_serializer: ResultSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
render jsonapi: @result, serializer: ResultSerializer
|
render jsonapi: @result, include: %w(
|
||||||
|
result_table result_text result_asset
|
||||||
|
), serializer: ResultSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Api
|
||||||
type :results
|
type :results
|
||||||
attributes :id, :name, :my_module_id, :user_id, :created_at, :updated_at,
|
attributes :id, :name, :my_module_id, :user_id, :created_at, :updated_at,
|
||||||
:archived, :archived_on, :last_modified_by_id, :archived_by_id,
|
:archived, :archived_on, :last_modified_by_id, :archived_by_id,
|
||||||
:restored_by_id, :restored_on
|
:restored_by_id, :restored_on, :result_text, :result_table, :result_asset
|
||||||
|
|
||||||
belongs_to :my_module, serializer: MyModuleSerializer
|
belongs_to :my_module, serializer: MyModuleSerializer
|
||||||
end
|
end
|
||||||
|
|
|
@ -540,7 +540,7 @@ Rails.application.routes.draw do
|
||||||
get 'health', to: 'api#health'
|
get 'health', to: 'api#health'
|
||||||
get 'status', to: 'api#status'
|
get 'status', to: 'api#status'
|
||||||
post 'auth/token', to: 'api#authenticate'
|
post 'auth/token', to: 'api#authenticate'
|
||||||
#if Api.configuration.core_api_v1_preview
|
if Api.configuration.core_api_v1_preview
|
||||||
namespace :v1 do
|
namespace :v1 do
|
||||||
resources :teams, only: %i(index show) do
|
resources :teams, only: %i(index show) do
|
||||||
resources :inventories,
|
resources :inventories,
|
||||||
|
@ -572,6 +572,9 @@ Rails.application.routes.draw do
|
||||||
resources :protocols, only: %i(index show),
|
resources :protocols, only: %i(index show),
|
||||||
path: 'protocols',
|
path: 'protocols',
|
||||||
as: :protocols
|
as: :protocols
|
||||||
|
resources :results, only: %i(index show),
|
||||||
|
path: 'results',
|
||||||
|
as: :results
|
||||||
get 'inputs',
|
get 'inputs',
|
||||||
to: 'my_modules#inputs'
|
to: 'my_modules#inputs'
|
||||||
get 'inputs/:id',
|
get 'inputs/:id',
|
||||||
|
@ -599,7 +602,7 @@ Rails.application.routes.draw do
|
||||||
only: %i(index create show update destroy)
|
only: %i(index create show update destroy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue