refactor: improve formatting of apply_transaction_to_balance function and add TODO for transaction service integration
This commit is contained in:
@@ -28,7 +28,12 @@ fn is_liability_account(account_type: &str) -> bool {
|
||||
}
|
||||
|
||||
/// Apply transaction amount to balance based on account type
|
||||
fn apply_transaction_to_balance(balance: &mut Decimal, amount: Decimal, txn_type: &str, is_liability: bool) {
|
||||
fn apply_transaction_to_balance(
|
||||
balance: &mut Decimal,
|
||||
amount: Decimal,
|
||||
txn_type: &str,
|
||||
is_liability: bool,
|
||||
) {
|
||||
if is_liability {
|
||||
// For liability accounts: expenses increase debt, payments decrease debt
|
||||
match txn_type {
|
||||
@@ -516,6 +521,7 @@ impl AccountService for AccountServiceImpl {
|
||||
let is_liability = is_liability_account(&account.account_type);
|
||||
|
||||
// Query transactions directly for balance recalculation
|
||||
// TODO: use transcation service
|
||||
let transactions = Transactions::find()
|
||||
.filter(transactions::Column::AccountId.eq(account_id))
|
||||
.filter(transactions::Column::IsDeleted.eq(false))
|
||||
|
||||
Reference in New Issue
Block a user