You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(backend): migrate Float monetary fields to Decimal (#237) (#410)
* refactor(backend): migrate Float monetary fields to Decimal (#237)
- Change Campaign.budget, Claim.amount, AidPackage.totalAmount/claimedAmount/remainingAmount,
and BalanceLedger.amount from Float to Decimal(38, 18)
- Add migration script to convert existing data
- Add DecimalSerializerInterceptor to serialize Decimal as strings in API responses
- Add money-roundtrip.spec.ts to prove lossless serialization
* fix(backend): use Decimal methods for negation and accumulation in cancel-and-reissue service
* fix(backend): match Prisma Decimal toString behavior in round-trip tests
* fix(backend): add .toNumber() at Decimal boundaries to satisfy TS types
- budget.service.ts: aggregate amounts via .toNumber() ?? 0, compare via .toNumber()
- campaigns.controller.ts: .toNumber() on budget before arithmetic
- cancel-and-reissue.service.ts: .toNumber() for event amounts, typeof guard for union
- claims.service.ts: .toNumber() for ClaimReceiptDto.amount
- ledger-reconciliation.service.ts: .toNumber() for stored entry in Math.abs()
* fix(backend): use Decimal mocks in budget.service.spec.ts
* fix(backend): update coverage baseline for cancel-and-reissue.service.ts branches
---------
Co-authored-by: DeRossa1 <DeRossa1@users.noreply.github.com>
0 commit comments