-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
438 changed files
with
5,516 additions
and
5,630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
# Load DSL and set up stages | ||
require 'capistrano/setup' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require File.expand_path('../config/application', __FILE__) | ||
require File.expand_path('config/application', __dir__) | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,56 @@ | ||
class Api::V1::CustomersController < ApiController | ||
include Api | ||
|
||
before_action :set_customer, only: [:show, :update, :destroy] | ||
|
||
def index | ||
@customers = Customer.order(name: :asc) | ||
end | ||
|
||
def show | ||
end | ||
|
||
def create | ||
@customer = Customer.new(customer_params) | ||
if @customer.save | ||
render 'show' | ||
else | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
end | ||
|
||
def update | ||
if @customer.update(customer_params) | ||
render 'show' | ||
else | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
end | ||
|
||
def destroy | ||
@customer.destroy | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_customer | ||
@customer = Customer.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def customer_params | ||
params | ||
.require(:customer) | ||
.permit( | ||
# frozen_string_literal: true | ||
|
||
module Api | ||
module V1 | ||
class CustomersController < ApiController | ||
include Api | ||
|
||
before_action :set_customer, only: %i[show update destroy] | ||
|
||
def index | ||
@customers = Customer.order(name: :asc) | ||
end | ||
|
||
def show; end | ||
|
||
def create | ||
@customer = Customer.new(customer_params) | ||
if @customer.save | ||
render 'show' | ||
else | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
end | ||
|
||
def update | ||
if @customer.update(customer_params) | ||
render 'show' | ||
else | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
end | ||
|
||
def destroy | ||
@customer.destroy | ||
render json: ResponseFactory.get_response_for(@customer) | ||
end | ||
|
||
private | ||
|
||
# Use callbacks to share common setup or constraints between actions. | ||
def set_customer | ||
@customer = Customer.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def customer_params | ||
params | ||
.require(:customer) | ||
.permit( | ||
:name, :tax_id, :billing_serie, :irpf, :contact_name, :contact_phone, :contact_email, | ||
:address, :city, :country, :state, :postal_code, :send_invoices_to | ||
) | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::DashboardController < ApiController | ||
def index | ||
@reports = TotalsCalculator.for(current_user) | ||
module Api | ||
module V1 | ||
class DashboardController < ApiController | ||
def index | ||
@reports = TotalsCalculator.for(current_user) | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.