def update_transaction(transaction: Transaction, old_amount: int) -> Transaction: transaction = db_update_one(transaction) account_amount = -old_amount + transaction.amount increase = transaction.type == TransactionType.INCOME.value account = _update_related_account_balance(transaction.account_id, account_amount, increase=increase) transaction.account = account return transaction
def update_employer(employer: Employer) -> Employer: return db_update_one(employer)
def delete_employer(employer: Employer) -> Employer: employer.is_deleted = True return db_update_one(employer)
def update_finance_category( finance_category: FinanceCategory) -> FinanceCategory: return db_update_one(finance_category)
def delete_finance_category( finance_category: FinanceCategory) -> FinanceCategory: finance_category.is_deleted = True return db_update_one(finance_category)