Update #16

Merged
ameye merged 1 commits from testing into master 2025-05-03 11:17:39 +00:00
5 changed files with 18 additions and 5 deletions
+1
View File
@@ -167,6 +167,7 @@ def get_all_loan_charges():
# Extract query parameters for filtering
filters = {
'loan_id': request.args.get('loan_id'),
'transaction_id': request.args.get('transaction_id'),
'code': request.args.get('code'),
'start_date': request.args.get('start_date'),
'end_date': request.args.get('end_date'),
+2
View File
@@ -28,6 +28,7 @@ class LoanChargeService:
# Extract filters
loan_id = filters.get('loan_id')
transaction_id = filters.get('transaction_id')
code = filters.get('code')
start_date = filters.get('start_date')
end_date = filters.get('end_date')
@@ -57,6 +58,7 @@ class LoanChargeService:
# Get loan charges with optional filters and pagination
loan_charges, total_count = LoanCharge.get_all_loan_charges(
loan_id=loan_id,
transaction_id=transaction_id,
code=code,
start_date=start_date,
end_date=end_date,
+5 -1
View File
@@ -18,13 +18,14 @@ class LoanCharge(db.Model):
due_date = db.Column(db.DateTime)
@classmethod
def get_all_loan_charges(cls, loan_id=None, code=None, start_date=None, end_date=None,
def get_all_loan_charges(cls, loan_id=None, transaction_id=None, code=None, start_date=None, end_date=None,
due_before=None, due_after=None, page=1, limit=20):
"""
Get all loan charges with optional filtering
Args:
loan_id (int, optional): Filter by loan ID
transaction_id (int, optional): Filter by transaction ID
code (str, optional): Filter by charge code
start_date (datetime, optional): Filter by start date (created_at)
end_date (datetime, optional): Filter by end date (created_at)
@@ -42,6 +43,9 @@ class LoanCharge(db.Model):
if loan_id:
query = query.filter(cls.loan_id == loan_id)
if transaction_id:
query = query.filter(cls.transaction_id == transaction_id)
if code:
query = query.filter(cls.code == code)
+10
View File
@@ -15,6 +15,16 @@
},
"example": 7463
},
{
"name": "transaction_id",
"in": "query",
"description": "Filter by transaction ID",
"required": false,
"schema": {
"type": "string"
},
"example": "TRX789"
},
{
"name": "code",
"in": "query",
@@ -32,10 +32,6 @@
"type": "integer",
"example": 0
},
"transaction_ {
"type": "integer",
"example": 0
},
"transaction_id": {
"type": "string",
"example": "TRX123456",