fix(miniapp): show original ledger currencies

This commit is contained in:
2026-03-10 15:58:33 +04:00
parent d55bf42c7b
commit 4c0508f618
9 changed files with 35 additions and 12 deletions

View File

@@ -247,6 +247,7 @@ describe('createFinanceCommandService', () => {
id: 'purchase-1',
payerMemberId: 'alice',
amountMinor: 3000n,
currency: 'GEL',
description: 'Soap',
occurredAt: instantFromIso('2026-03-12T11:00:00.000Z')
}
@@ -259,6 +260,7 @@ describe('createFinanceCommandService', () => {
expect(dashboard).not.toBeNull()
expect(dashboard?.members.map((line) => line.netDue.amountMinor)).toEqual([39500n, 42500n])
expect(dashboard?.ledger.map((entry) => entry.title)).toEqual(['Soap', 'Electricity'])
expect(dashboard?.ledger.map((entry) => entry.currency)).toEqual(['GEL', 'USD'])
expect(statement).toBe(
[
'Statement for 2026-03',

View File

@@ -72,6 +72,7 @@ export interface FinanceDashboardLedgerEntry {
kind: 'purchase' | 'utility'
title: string
amount: Money
currency: CurrencyCode
actorDisplayName: string | null
occurredAt: string | null
}
@@ -182,6 +183,7 @@ async function buildFinanceDashboard(
kind: 'utility' as const,
title: bill.billName,
amount: Money.fromMinor(bill.amountMinor, bill.currency),
currency: bill.currency,
actorDisplayName: bill.createdByMemberId
? (memberNameById.get(bill.createdByMemberId) ?? null)
: null,
@@ -191,7 +193,8 @@ async function buildFinanceDashboard(
id: purchase.id,
kind: 'purchase' as const,
title: purchase.description ?? 'Shared purchase',
amount: Money.fromMinor(purchase.amountMinor, rentRule.currency),
amount: Money.fromMinor(purchase.amountMinor, purchase.currency),
currency: purchase.currency,
actorDisplayName: memberNameById.get(purchase.payerMemberId) ?? null,
occurredAt: purchase.occurredAt?.toString() ?? null
}))