From ac72905ecb43ff01efa328828ca77be580fe75de Mon Sep 17 00:00:00 2001 From: olsch01 Date: Tue, 10 Mar 2026 09:17:08 -0400 Subject: [PATCH] fix: add total_debit/total_credit aggregations to journal entries list The findAll query was missing SUM aggregations, so the frontend received no total_debit/total_credit fields and fell back to displaying $0.00. Co-Authored-By: Claude Opus 4.6 --- backend/src/modules/journal-entries/journal-entries.service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/modules/journal-entries/journal-entries.service.ts b/backend/src/modules/journal-entries/journal-entries.service.ts index 4f67d5c..dc768b0 100644 --- a/backend/src/modules/journal-entries/journal-entries.service.ts +++ b/backend/src/modules/journal-entries/journal-entries.service.ts @@ -13,6 +13,8 @@ export class JournalEntriesService { async findAll(filters: { from?: string; to?: string; accountId?: string; type?: string }) { let sql = ` SELECT je.*, + COALESCE(SUM(jel.debit), 0) as total_debit, + COALESCE(SUM(jel.credit), 0) as total_credit, json_agg(json_build_object( 'id', jel.id, 'account_id', jel.account_id, 'debit', jel.debit, 'credit', jel.credit, 'memo', jel.memo,