This commit was merged in pull request #15.
This commit is contained in:
Azeez Muibi
2025-05-02 09:13:45 +01:00
parent 8f34942c1a
commit 7ec9eada4d
5 changed files with 24 additions and 1 deletions
+6 -1
View File
@@ -44,7 +44,7 @@ class Loan(db.Model):
)
@classmethod
def get_all_loans(cls, id=None, customer_id=None, account_id=None, status=None, offer_id=None,
def get_all_loans(cls, id=None, customer_id=None, account_id=None, status=None, tenor=None, offer_id=None,
product_id=None, start_date=None, end_date=None, due_before=None, due_after=None,
transaction_id=None, original_transaction=None, page=1, limit=20):
"""
@@ -55,6 +55,7 @@ class Loan(db.Model):
customer_id (str, optional): Filter by customer ID
account_id (str, optional): Filter by account ID
status (str, optional): Filter by loan status
tenor (str, optional): Filter by loan tenor
offer_id (str, optional): Filter by offer ID
product_id (str, optional): Filter by product ID
start_date (datetime, optional): Filter by start date (created_at)
@@ -82,6 +83,9 @@ class Loan(db.Model):
if status:
query = query.filter(cls.status == status)
if tenor:
query = query.filter(cls.tenor == tenor)
if offer_id:
query = query.filter(cls.offer_id == offer_id)
@@ -132,6 +136,7 @@ class Loan(db.Model):
'initial_loan_amount': self.initial_loan_amount,
'current_loan_amount': self.current_loan_amount,
'status': self.status,
'tenor': self.tenor,
'product_id': self.product_id,
'default_penalty_fee': self.default_penalty_fee,
'continuous_fee': self.continuous_fee,