mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 04:34:37 +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_inventory
|
||||
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
|
||||
columns = @inventory.repository_columns
|
||||
|
|
|
@ -7,7 +7,7 @@ module Api
|
|||
before_action :load_project
|
||||
before_action :load_experiment
|
||||
before_action :load_task
|
||||
before_action :load_task_repository_row, only: :show
|
||||
before_action :load_task_tag, only: :show
|
||||
|
||||
def index
|
||||
task_tags = @my_module.my_module_tags
|
||||
|
@ -48,7 +48,7 @@ module Api
|
|||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||
end
|
||||
|
||||
def load_task_repository_row
|
||||
def load_task_tag
|
||||
@task_tag = @my_module.my_module_tags.find(
|
||||
params.require(:id)
|
||||
)
|
||||
|
|
|
@ -30,7 +30,6 @@ module Api
|
|||
|
||||
def output
|
||||
output = @my_module.my_modules.find(params.require(:id))
|
||||
render jsonapi: {}, status: :not_found if output.nil?
|
||||
render jsonapi: output, serializer: MyModuleSerializer
|
||||
end
|
||||
|
||||
|
@ -43,7 +42,6 @@ module Api
|
|||
|
||||
def input
|
||||
input = @my_module.my_module_antecessors.find(params.require(:id))
|
||||
render jsonapi: {}, status: :not_found if input.nil?
|
||||
render jsonapi: input, serializer: MyModuleSerializer
|
||||
end
|
||||
|
||||
|
@ -70,7 +68,6 @@ module Api
|
|||
|
||||
def load_task
|
||||
@my_module = @experiment.my_modules.find(params.require(:id))
|
||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||
end
|
||||
|
||||
# Made the method below because its more elegant than changing parameters
|
||||
|
@ -79,7 +76,6 @@ module Api
|
|||
# or input.
|
||||
def load_task_relative
|
||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,6 @@ module Api
|
|||
@protocol = @my_module.protocols.find(
|
||||
params.require(:id)
|
||||
)
|
||||
render jsonapi: {}, status: :not_found if @protocol.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,14 +48,12 @@ module Api
|
|||
|
||||
def load_task
|
||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||
end
|
||||
|
||||
def load_result
|
||||
@result = @my_module.results.find(
|
||||
params.require(:id)
|
||||
)
|
||||
render jsonapi: {}, status: :not_found if @result.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,14 +45,12 @@ module Api
|
|||
|
||||
def load_task
|
||||
@my_module = @experiment.my_modules.find(params.require(:task_id))
|
||||
render jsonapi: {}, status: :not_found if @my_module.nil?
|
||||
end
|
||||
|
||||
def load_user_task
|
||||
@user_task = @my_module.user_my_modules.find(
|
||||
params.require(:id)
|
||||
)
|
||||
render jsonapi: {}, status: :not_found if @user_task.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,6 @@ module Api
|
|||
module V1
|
||||
class MyModuleRepositoryRowSerializer < ActiveModel::Serializer
|
||||
type :task_inventory_rows
|
||||
attribute :id
|
||||
attribute :repository_row_id, key: :inventory_row_id
|
||||
attribute :my_module_id, key: :task_id
|
||||
belongs_to :my_module, serializer: MyModuleSerializer
|
||||
|
|
Loading…
Add table
Reference in a new issue