mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
Fix GET /tasks/:id/inputs, GET /tasks/:id/outputs endpoints
This commit is contained in:
parent
239b974fa0
commit
fca580face
2 changed files with 8 additions and 24 deletions
|
@ -7,7 +7,7 @@ module Api
|
|||
before_action :load_project
|
||||
before_action :load_experiment
|
||||
before_action :load_task, only: :show
|
||||
before_action :load_task_relative, only: %i(outputs output inputs input)
|
||||
before_action :load_task_relative, only: %i(inputs outputs)
|
||||
|
||||
def index
|
||||
tasks = @experiment.my_modules
|
||||
|
@ -21,18 +21,6 @@ module Api
|
|||
render jsonapi: @task, serializer: TaskSerializer
|
||||
end
|
||||
|
||||
def outputs
|
||||
outputs = @task.my_modules
|
||||
.page(params.dig(:page, :number))
|
||||
.per(params.dig(:page, :size))
|
||||
render jsonapi: outputs, each_serializer: TaskSerializer
|
||||
end
|
||||
|
||||
def output
|
||||
output = @task.my_modules.find(params.require(:id))
|
||||
render jsonapi: output, serializer: TaskSerializer
|
||||
end
|
||||
|
||||
def inputs
|
||||
inputs = @task.my_module_antecessors
|
||||
.page(params.dig(:page, :number))
|
||||
|
@ -40,9 +28,11 @@ module Api
|
|||
render jsonapi: inputs, each_serializer: TaskSerializer
|
||||
end
|
||||
|
||||
def input
|
||||
input = @task.my_module_antecessors.find(params.require(:id))
|
||||
render jsonapi: input, serializer: TaskSerializer
|
||||
def outputs
|
||||
outputs = @task.my_modules
|
||||
.page(params.dig(:page, :number))
|
||||
.per(params.dig(:page, :size))
|
||||
render jsonapi: outputs, each_serializer: TaskSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -579,14 +579,8 @@ Rails.application.routes.draw do
|
|||
resources :results, only: %i(index create show),
|
||||
path: 'results',
|
||||
as: :results
|
||||
get 'inputs',
|
||||
to: 'my_modules#inputs'
|
||||
get 'inputs/:id',
|
||||
to: 'my_modules#input'
|
||||
get 'outputs',
|
||||
to: 'my_modules#outputs'
|
||||
get 'outputs/:id',
|
||||
to: 'my_modules#output'
|
||||
get 'inputs', to: 'tasks#inputs'
|
||||
get 'outputs', to: 'tasks#outputs'
|
||||
resources :activities, only: %i(index show),
|
||||
path: 'activities',
|
||||
as: :activities
|
||||
|
|
Loading…
Reference in a new issue