mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 06:04:35 +08:00
fixed pull request review
This commit is contained in:
parent
e47acfb4a1
commit
1a9890ee0f
7 changed files with 3 additions and 13 deletions
|
@ -6,7 +6,7 @@ module Api
|
||||||
before_action :load_team
|
before_action :load_team
|
||||||
before_action :load_inventory
|
before_action :load_inventory
|
||||||
before_action :load_inventory_column, only: %i(show update destroy)
|
before_action :load_inventory_column, only: %i(show update destroy)
|
||||||
before_action :check_manage_permissions, only: %i(update destroy)
|
before_action :check_manage_permissions, only: %i(create update destroy)
|
||||||
|
|
||||||
def index
|
def index
|
||||||
columns = @inventory.repository_columns
|
columns = @inventory.repository_columns
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Api
|
||||||
before_action :load_project
|
before_action :load_project
|
||||||
before_action :load_experiment
|
before_action :load_experiment
|
||||||
before_action :load_task
|
before_action :load_task
|
||||||
before_action :load_task_repository_row, only: :show
|
before_action :load_task_tag, only: :show
|
||||||
|
|
||||||
def index
|
def index
|
||||||
task_tags = @my_module.my_module_tags
|
task_tags = @my_module.my_module_tags
|
||||||
|
@ -48,7 +48,7 @@ module Api
|
||||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_task_repository_row
|
def load_task_tag
|
||||||
@task_tag = @my_module.my_module_tags.find(
|
@task_tag = @my_module.my_module_tags.find(
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,7 +30,6 @@ module Api
|
||||||
|
|
||||||
def output
|
def output
|
||||||
output = @my_module.my_modules.find(params.require(:id))
|
output = @my_module.my_modules.find(params.require(:id))
|
||||||
render jsonapi: {}, status: :not_found if output.nil?
|
|
||||||
render jsonapi: output, serializer: MyModuleSerializer
|
render jsonapi: output, serializer: MyModuleSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,7 +42,6 @@ module Api
|
||||||
|
|
||||||
def input
|
def input
|
||||||
input = @my_module.my_module_antecessors.find(params.require(:id))
|
input = @my_module.my_module_antecessors.find(params.require(:id))
|
||||||
render jsonapi: {}, status: :not_found if input.nil?
|
|
||||||
render jsonapi: input, serializer: MyModuleSerializer
|
render jsonapi: input, serializer: MyModuleSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -70,7 +68,6 @@ module Api
|
||||||
|
|
||||||
def load_task
|
def load_task
|
||||||
@my_module = @experiment.my_modules.find(params.require(:id))
|
@my_module = @experiment.my_modules.find(params.require(:id))
|
||||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Made the method below because its more elegant than changing parameters
|
# Made the method below because its more elegant than changing parameters
|
||||||
|
@ -79,7 +76,6 @@ module Api
|
||||||
# or input.
|
# or input.
|
||||||
def load_task_relative
|
def load_task_relative
|
||||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,6 @@ module Api
|
||||||
@protocol = @my_module.protocols.find(
|
@protocol = @my_module.protocols.find(
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
)
|
)
|
||||||
render jsonapi: {}, status: :not_found if @protocol.nil?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,14 +48,12 @@ module Api
|
||||||
|
|
||||||
def load_task
|
def load_task
|
||||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_result
|
def load_result
|
||||||
@result = @my_module.results.find(
|
@result = @my_module.results.find(
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
)
|
)
|
||||||
render jsonapi: {}, status: :not_found if @result.nil?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,14 +45,12 @@ module Api
|
||||||
|
|
||||||
def load_task
|
def load_task
|
||||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_user_task
|
def load_user_task
|
||||||
@user_task = @my_module.user_my_modules.find(
|
@user_task = @my_module.user_my_modules.find(
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
)
|
)
|
||||||
render jsonapi: {}, status: :not_found if @user_task.nil?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,6 @@ module Api
|
||||||
module V1
|
module V1
|
||||||
class MyModuleRepositoryRowSerializer < ActiveModel::Serializer
|
class MyModuleRepositoryRowSerializer < ActiveModel::Serializer
|
||||||
type :task_inventory_rows
|
type :task_inventory_rows
|
||||||
attribute :id
|
|
||||||
attribute :repository_row_id, key: :inventory_row_id
|
attribute :repository_row_id, key: :inventory_row_id
|
||||||
attribute :my_module_id, key: :task_id
|
attribute :my_module_id, key: :task_id
|
||||||
belongs_to :my_module, serializer: MyModuleSerializer
|
belongs_to :my_module, serializer: MyModuleSerializer
|
||||||
|
|
Loading…
Add table
Reference in a new issue