Define an endpoint to expose the list of expenses
This commit is contained in:
parent
8d74d25574
commit
810d0740f3
@ -4,4 +4,8 @@ class ExpensesController < ApplicationController
|
||||
def summary
|
||||
render json: Expenses::TotalQuery.new.call
|
||||
end
|
||||
|
||||
def index
|
||||
render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type])
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ Rails.application.routes.draw do
|
||||
post :import, on: :collection
|
||||
post :bulk_update, on: :collection
|
||||
end
|
||||
resources :expenses do
|
||||
resources :expenses, only: :index do
|
||||
get :summary, on: :collection
|
||||
end
|
||||
resources :tables_arrangements, only: [:index, :show]
|
||||
|
Loading…
x
Reference in New Issue
Block a user