wedding-planner/app/controllers/summary_controller.rb
Manuel Bustillo da8f3c7618
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 1m31s
Add copyright notice / copyright_notice (pull_request) Successful in 1m34s
Run unit tests / unit_tests (pull_request) Successful in 3m55s
Define an endpoint with a global summary of expenses and attendance
2024-12-11 09:01:35 +01:00

28 lines
669 B
Ruby

class SummaryController < ApplicationController
def index
expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call
render json: {
expenses: {
projected: {
total: expense_summary['total_projected'],
guests: expense_summary['projected_guests']
},
confirmed: {
total: expense_summary['total_confirmed'],
guests: expense_summary['confirmed_guests']
},
status: {
paid: 0
}
},
guests: {
total: 200,
confirmed: 100,
declined: 50,
tentative: 25,
invited: 25
}
}
end
end