Merge branch 'testing' of DigiFi/FirstCore into master
This commit is contained in:
@@ -129,6 +129,7 @@ def get_transactions():
|
|||||||
# Extract query parameters for filtering
|
# Extract query parameters for filtering
|
||||||
filters = {
|
filters = {
|
||||||
'account_id': request.args.get('account_id'),
|
'account_id': request.args.get('account_id'),
|
||||||
|
'transaction_id': request.args.get('transaction_id'),
|
||||||
'type': request.args.get('type'),
|
'type': request.args.get('type'),
|
||||||
'channel': request.args.get('channel'),
|
'channel': request.args.get('channel'),
|
||||||
'start_date': request.args.get('start_date'),
|
'start_date': request.args.get('start_date'),
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ from .transaction import Transaction
|
|||||||
from .user import User
|
from .user import User
|
||||||
from .repayment import Repayment
|
from .repayment import Repayment
|
||||||
from .loan_charge import LoanCharge
|
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']
|
||||||
@@ -50,12 +50,13 @@ class Transaction(db.Model):
|
|||||||
return cls.query.get(transaction_id)
|
return cls.query.get(transaction_id)
|
||||||
|
|
||||||
@classmethod
|
@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
|
Get all transactions with optional filtering
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
account_id (str, optional): Filter by account ID
|
account_id (str, optional): Filter by account ID
|
||||||
|
transaction_id (str, optional): Filter by transaction ID
|
||||||
transaction_type (str, optional): Filter by transaction type
|
transaction_type (str, optional): Filter by transaction type
|
||||||
channel (str, optional): Filter by channel
|
channel (str, optional): Filter by channel
|
||||||
start_date (datetime, optional): Filter by start date
|
start_date (datetime, optional): Filter by start date
|
||||||
@@ -70,6 +71,9 @@ class Transaction(db.Model):
|
|||||||
if account_id:
|
if account_id:
|
||||||
query = query.filter(cls.account_id == account_id)
|
query = query.filter(cls.account_id == account_id)
|
||||||
|
|
||||||
|
if transaction_id:
|
||||||
|
query = query.filter(cls.transaction_id == transaction_id)
|
||||||
|
|
||||||
if transaction_type:
|
if transaction_type:
|
||||||
query = query.filter(cls.type == transaction_type)
|
query = query.filter(cls.type == transaction_type)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,16 @@
|
|||||||
},
|
},
|
||||||
"example": "ACC456"
|
"example": "ACC456"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "transaction_id",
|
||||||
|
"in": "query",
|
||||||
|
"description": "Filter by transaction ID",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"example": "TRX789"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "type",
|
"name": "type",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
|
|||||||
Reference in New Issue
Block a user