feat(api): expose valuation history index (#1596)

* feat(api): expose valuation history index

* fix(api): hide valuation exception details

* fix(api): reuse eager-loaded valuation entries

* fix(api): tighten valuation index contracts

* fix(api): scope valuation filter errors

* docs(api): nest valuation account filter format

* Fix merge conflict mistakes

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <jjmata@jjmata.com>
This commit is contained in:
ghost
2026-05-01 11:09:56 -06:00
committed by GitHub
parent a7e964f8be
commit 352c301e4b
8 changed files with 326 additions and 44 deletions

View File

@@ -1,17 +1,19 @@
# frozen_string_literal: true
json.id valuation.entry.id
json.date valuation.entry.date
json.amount valuation.entry.amount_money.format
json.currency valuation.entry.currency
json.notes valuation.entry.notes
entry = local_assigns[:entry] || valuation.entry
json.id entry.id
json.date entry.date
json.amount entry.amount_money.format
json.currency entry.currency
json.notes entry.notes
json.kind valuation.kind
# Account information
json.account do
json.id valuation.entry.account.id
json.name valuation.entry.account.name
json.account_type valuation.entry.account.accountable_type.underscore
json.id entry.account.id
json.name entry.account.name
json.account_type entry.account.accountable_type.underscore
end
# Additional metadata

View File

@@ -0,0 +1,12 @@
# frozen_string_literal: true
json.valuations @entries do |entry|
json.partial! "valuation", valuation: entry.entryable, entry: entry
end
json.pagination do
json.page @pagy.page
json.per_page @per_page
json.total_count @pagy.count
json.total_pages @pagy.pages
end