mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 11:57:16 +08:00
Fix CREATE inventory endpoint [SCI-2693]
This commit is contained in:
parent
3099725065
commit
9d9a5d07d8
1 changed files with 7 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue