Simpl-Resultat/src/utils
le king fu 4a93c60ea7 feat(reports): plumb accountIds[] account filter into 7 report services
Give every report service an optional accountIds?: number[] filter that
narrows results to a subset of import sources (transactions.source_id),
matched via a parameterized IN (...) clause — one bound placeholder per
id, never a joined string (CWE-89). New shared inPlaceholders() helper
(src/utils/sqlFilters.ts) generates the placeholder list so the pattern
lives in exactly one place.

New accountIds param: getCompareMonthOverMonth, getCompareYearOverYear,
getBudgetVsActualData, getCartesSnapshot (forwarded to its
getCompareMonthOverMonth + getBudgetVsActualData sub-calls, so the
Cartes dashboard's top-movers and budget-adherence cards respect an
active filter instead of silently ignoring it).

Signature change scalar -> plural: getMonthlyTrends, getCategoryOverTime,
getExpensesByCategory (sourceId?: number -> accountIds?: number[]). No
scalar production caller of these three passed sourceId today, so only
the test call-sites needed updating to the array shape.

Omitted/empty accountIds adds no clause at all, so every service stays
byte-identical to its pre-#273 SQL/results — pinned by a regression test
per service (new budgetService.test.ts / dashboardService.test.ts files,
extended reportService.test.ts / reportService.cartes.test.ts).

This is backend plumbing only: no report page exposes an account filter
control yet (follow-up issues #274-#276 add the shared <FilterPanel> and
wire it into Trends/Compare/Budget).

Resolves #273

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 15:15:37 -04:00
..
amountParser.ts feat: implement CSV import wizard with folder-based source detection 2026-02-08 03:38:46 +00:00
chartPatterns.tsx feat: add chart patterns, context menu, and import preview popup (v0.2.3) 2026-02-13 23:55:19 +00:00
collapsibleRows.test.ts feat(reports): collapse/expand sub-categories in comparable reports (#254) 2026-07-06 20:18:52 -04:00
collapsibleRows.ts feat(reports): collapse/expand sub-categories in comparable reports (#254) 2026-07-06 20:18:52 -04:00
csvAutoDetect.test.ts feat(balance): CSV import of holdings in detailed snapshot 2026-07-04 18:04:12 -04:00
csvAutoDetect.ts feat(balance): CSV import of holdings in detailed snapshot 2026-07-04 18:04:12 -04:00
dateParser.ts fix: reload column headers on config change and add YYYYMMDD date format 2026-02-08 04:08:33 +00:00
dateRange.test.ts test: add unit tests for dateRange.ts utility 2026-03-10 23:05:32 -04:00
dateRange.ts fix: address reviewer feedback (#31) 2026-03-10 18:53:31 -04:00
referencePeriod.test.ts feat(reports/highlights): default reference month to previous month + YTD current year, user-changeable (#106) 2026-04-19 08:28:30 -04:00
referencePeriod.ts feat(reports/highlights): default reference month to previous month + YTD current year, user-changeable (#106) 2026-04-19 08:28:30 -04:00
renderCategoryLabel.test.ts feat(balance): account form vehicle field + category rename via custom_label (#203) 2026-06-01 20:50:40 -04:00
renderCategoryLabel.ts feat(balance): account form vehicle field + category rename via custom_label (#203) 2026-06-01 20:50:40 -04:00
reorderRows.ts feat(reports): hierarchical real-vs-real compare with subtotals 2026-07-04 17:32:38 -04:00
sqlFilters.test.ts feat(reports): plumb accountIds[] account filter into 7 report services 2026-07-11 15:15:37 -04:00
sqlFilters.ts feat(reports): plumb accountIds[] account filter into 7 report services 2026-07-11 15:15:37 -04:00