wedding-planner/app/controllers/expenses_controller.rb
Manuel Bustillo 810d0740f3
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 44s
Add copyright notice / copyright_notice (pull_request) Successful in 2m30s
Run unit tests / unit_tests (pull_request) Successful in 6m1s
Define an endpoint to expose the list of expenses
2024-11-10 20:40:37 +01:00

12 lines
294 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
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