mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 19:51:01 +08:00
Review changes
This commit is contained in:
parent
ae3c19ced5
commit
1159ce519c
3 changed files with 13 additions and 5 deletions
|
@ -6,7 +6,7 @@ module Api
|
|||
before_action :load_team
|
||||
before_action :load_project
|
||||
before_action :load_experiment
|
||||
before_action :load_task_groups, only: :show
|
||||
before_action :load_task_group, only: :show
|
||||
|
||||
def index
|
||||
my_module_groups = @experiment.my_module_groups
|
||||
|
@ -42,11 +42,10 @@ module Api
|
|||
)
|
||||
end
|
||||
|
||||
def load_task_groups
|
||||
def load_task_group
|
||||
@my_module_group = @experiment.my_module_groups.find(
|
||||
params.require(:id)
|
||||
)
|
||||
render jsonapi: {}, status: :not_found if @my_module_group.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,15 @@ module Api
|
|||
class ConnectionSerializer < ActiveModel::Serializer
|
||||
type :connections
|
||||
attributes :id, :input_id, :output_id
|
||||
has_one :input_task, serializer: MyModuleSerializer
|
||||
has_one :output_task, serializer: MyModuleSerializer
|
||||
def input_task
|
||||
MyModule.find(object.input_id)
|
||||
end
|
||||
|
||||
def output_task
|
||||
MyModule.find(object.output_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,8 +4,8 @@ module Api
|
|||
module V1
|
||||
class MyModuleSerializer < ActiveModel::Serializer
|
||||
type :tasks
|
||||
attributes :id, :name, :due_date, :description,
|
||||
:my_module_group_id, :nr_of_assigned_samples, :state
|
||||
attributes :id, :name, :due_date, :description, :state
|
||||
attribute :my_module_group_id, key: :task_group_id
|
||||
belongs_to :experiment, serializer: ExperimentSerializer
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue