mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-31 04:32:06 +08:00
Merge pull request #1301 from okriuchykhin/ok_SCI_2693_v2
Fix CREATE inventory endpoint [SCI-2693]
This commit is contained in:
commit
b38e85c282
1 changed files with 7 additions and 2 deletions
|
@ -5,7 +5,7 @@ module Api
|
|||
class InventoriesController < BaseController
|
||||
before_action :load_team
|
||||
before_action :load_inventory, only: %i(show update destroy)
|
||||
before_action :check_manage_permissions, only: %i(create update destroy)
|
||||
before_action :check_manage_permissions, only: %i(update destroy)
|
||||
|
||||
def index
|
||||
inventories = @team.repositories
|
||||
|
@ -15,7 +15,12 @@ module Api
|
|||
end
|
||||
|
||||
def create
|
||||
inventory = @team.repositories.create!(inventory_params)
|
||||
unless can_create_repositories?(@team)
|
||||
return render body: nil, status: :forbidden
|
||||
end
|
||||
inventory = @team.repositories.create!(
|
||||
inventory_params.merge(created_by: current_user)
|
||||
)
|
||||
render jsonapi: inventory,
|
||||
serializer: InventorySerializer,
|
||||
status: :created
|
||||
|
|
Loading…
Reference in a new issue