fix(folio): cap a transaction at one million dollars

This commit is contained in:
pj committed 2026-08-15 20:31:07 +05:30
1 parent a6fdcb5825
commit e584cb316f
3 files changed
+74

No files matched your search

@@ -3,6 +3,7 @@ package app.folio.feature.ledger
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import app.folio.core.data.Account
import app.folio.core.data.MAX_TRANSACTION_AMOUNT_CENTS
import app.folio.core.data.Repository
import app.folio.core.data.TxnType
import app.folio.navigation.Navigator
@@ -87,6 +88,10 @@ class AddTransactionViewModel(
form.update { it.copy(error = "Amount must be greater than zero") }
return
}
if (cents > MAX_TRANSACTION_AMOUNT_CENTS) {
form.update { it.copy(error = "Amount is too large (max \$1,000,000.00)") }
return
}
viewModelScope.launch {
try {
repository.createTransaction(accountId, s.type, cents, s.note)