Added transaction ID

This commit was merged in pull request #12.
This commit is contained in:
Azeez Muibi
2025-04-28 21:48:35 +01:00
parent 510d4574ce
commit a27f4333f3
4 changed files with 18 additions and 2 deletions
+2 -1
View File
@@ -5,5 +5,6 @@ from .transaction import Transaction
from .user import User
from .repayment import Repayment
from .loan_charge import LoanCharge
from .loan_repayment_schedule import LoanRepaymentSchedule
__all__ = ['Customer', 'Account', 'Loan', 'Transaction', 'User', 'Repayment', 'LoanCharge']
__all__ = ['Customer', 'Account', 'Loan', 'Transaction', 'User', 'Repayment', 'LoanCharge', 'LoanRepaymentSchedule']
+5 -1
View File
@@ -50,12 +50,13 @@ class Transaction(db.Model):
return cls.query.get(transaction_id)
@classmethod
def get_all_transactions(cls, account_id=None, transaction_type=None, channel=None, start_date=None, end_date=None, page=1, limit=20):
def get_all_transactions(cls, account_id=None, transaction_id=None, transaction_type=None, channel=None, start_date=None, end_date=None, page=1, limit=20):
"""
Get all transactions with optional filtering
Args:
account_id (str, optional): Filter by account ID
transaction_id (str, optional): Filter by transaction ID
transaction_type (str, optional): Filter by transaction type
channel (str, optional): Filter by channel
start_date (datetime, optional): Filter by start date
@@ -70,6 +71,9 @@ class Transaction(db.Model):
if account_id:
query = query.filter(cls.account_id == account_id)
if transaction_id:
query = query.filter(cls.transaction_id == transaction_id)
if transaction_type:
query = query.filter(cls.type == transaction_type)