node-postgres returns numeric/decimal columns as JavaScript strings,
but the TypeScript interfaces for MaintenanceRecord and OwnershipCost
declare numeric fields as number. The mappers were passing values
through raw, breaking type-safe arithmetic and display (e.g. the
amount column on the vehicle summary screen was empty until the
recent frontend workaround in PR #240, and OwnershipCostsList silently
no-ops toLocaleString on the string).
Backend
- mapMaintenanceRecord: coerce cost via Number() when non-null.
- ownership-costs mapRow: coerce amount via Number().
Frontend (remove now-redundant workarounds)
- MaintenanceRecordsList: drop Number() coercion on cost and
odometerReading; use the number values directly.
- VehicleDetailPage / VehicleDetailMobile: revert the PR #240 cost
coercion to the simple typeof number guard now that the backend
honors the type.
Scope notes
- Other repositories with the same pattern (stations, community-stations,
fuel-logs enhanced methods) are tracked separately because they have
unclear downstream consumers and warrant their own investigation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>