API v1 financial_transactions endpoints (#627)
This commit is contained in:
parent
8c8b42c2b2
commit
b96ce06d94
10 changed files with 397 additions and 1 deletions
24
app/controllers/api/v1/financial_transactions_controller.rb
Normal file
24
app/controllers/api/v1/financial_transactions_controller.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class Api::V1::FinancialTransactionsController < Api::V1::BaseController
|
||||
include Concerns::CollectionScope
|
||||
|
||||
before_action ->{ doorkeeper_authorize! 'finance:read', 'finance:write' }
|
||||
|
||||
def index
|
||||
render_collection search_scope
|
||||
end
|
||||
|
||||
def show
|
||||
render json: scope.find(params.require(:id))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def scope
|
||||
FinancialTransaction.includes(:user)
|
||||
end
|
||||
|
||||
def ransack_auth_object
|
||||
:finance
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
class Api::V1::User::FinancialTransactionsController < Api::V1::BaseController
|
||||
include Concerns::CollectionScope
|
||||
|
||||
before_action ->{ doorkeeper_authorize! 'finance:user' }
|
||||
before_action :require_ordergroup
|
||||
|
||||
def index
|
||||
render_collection search_scope
|
||||
end
|
||||
|
||||
def show
|
||||
render json: scope.find(params.require(:id))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def scope
|
||||
current_ordergroup.financial_transactions.includes(:user)
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue