mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
fix refactoring issue in /api/open_api_clients
This commit is contained in:
parent
b790bc01e7
commit
5e8aeb928c
@ -11,35 +11,35 @@ class API::OpenAPIClientsController < API::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@projets = OpenAPI::Client.new(client_params)
|
@client = OpenAPI::Client.new(client_params)
|
||||||
authorize @projets
|
authorize @client
|
||||||
if @projets.save
|
if @client.save
|
||||||
render status: :created
|
render status: :created
|
||||||
else
|
else
|
||||||
render json: @projets.errors, status: :unprocessable_entity
|
render json: @client.errors, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@projets = OpenAPI::Client.find(params[:id])
|
@client = OpenAPI::Client.find(params[:id])
|
||||||
authorize @projets
|
authorize @client
|
||||||
if @projets.update(client_params)
|
if @client.update(client_params)
|
||||||
render status: :ok
|
render status: :ok
|
||||||
else
|
else
|
||||||
render json: @projets.errors, status: :unprocessable_entity
|
render json: @client.errors, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_token
|
def reset_token
|
||||||
@projets = OpenAPI::Client.find(params[:id])
|
@client = OpenAPI::Client.find(params[:id])
|
||||||
authorize @projets
|
authorize @client
|
||||||
@projets.regenerate_token
|
@client.regenerate_token
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@projets = OpenAPI::Client.find(params[:id])
|
@client = OpenAPI::Client.find(params[:id])
|
||||||
authorize @projets
|
authorize @client
|
||||||
@projets.destroy
|
@client.destroy
|
||||||
head 204
|
head 204
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1 +1,3 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
json.extract! client, :id, :name, :calls_count, :token, :created_at
|
json.extract! client, :id, :name, :calls_count, :token, :created_at
|
||||||
|
@ -1 +1,3 @@
|
|||||||
json.partial! 'api/open_api_clients/client', projets: @projets
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
json.partial! 'api/open_api_clients/client', client: @client
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
json.array! @clients do |client|
|
json.array! @clients do |client|
|
||||||
json.partial! 'api/open_api_clients/client', projets: client
|
json.partial! 'api/open_api_clients/client', client: client
|
||||||
end
|
end
|
||||||
|
@ -1 +1 @@
|
|||||||
json.partial! 'api/open_api_clients/client', projets: @projets
|
json.partial! 'api/open_api_clients/client', client: @client
|
||||||
|
@ -1 +1 @@
|
|||||||
json.partial! 'api/open_api_clients/client', projets: @projets
|
json.partial! 'api/open_api_clients/client', client: @client
|
||||||
|
Loading…
x
Reference in New Issue
Block a user