mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +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
|
@ -5,7 +5,7 @@ module Api
|
||||||
class InventoriesController < BaseController
|
class InventoriesController < BaseController
|
||||||
before_action :load_team
|
before_action :load_team
|
||||||
before_action :load_inventory, only: %i(show update destroy)
|
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
|
def index
|
||||||
inventories = @team.repositories
|
inventories = @team.repositories
|
||||||
|
@ -15,7 +15,12 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
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,
|
render jsonapi: inventory,
|
||||||
serializer: InventorySerializer,
|
serializer: InventorySerializer,
|
||||||
status: :created
|
status: :created
|
||||||
|
|
Loading…
Reference in a new issue