This commit is contained in:
Azeez Muibi
2025-04-17 17:34:20 +01:00
parent 3c88e53bab
commit c4ac25bbdd
+29 -43
View File
@@ -61,7 +61,7 @@ def login():
@api.route('/dashboard', methods=['GET']) @api.route('/dashboard', methods=['GET'])
@token_required # @token_required
def get_dashboard(): def get_dashboard():
# Call the dashboard service # Call the dashboard service
result = DashboardService.get_dashboard_data() result = DashboardService.get_dashboard_data()
@@ -69,50 +69,36 @@ def get_dashboard():
@api.route('/loans', methods=['GET']) @api.route('/loans', methods=['GET'])
@token_required # @token_required
def get_loans(): def get_loans():
# Extract query parameters # Extract query parameters for filtering
customer_id = request.args.get('customer_id') filters = {
loan_id = request.args.get('loan_id') 'customer_id': request.args.get('customer_id'),
status = request.args.get('status') 'account_id': request.args.get('account_id'),
offer_id = request.args.get('offer_id') 'status': request.args.get('status'),
product_id = request.args.get('product_id') 'offer_id': request.args.get('offer_id'),
start_date = request.args.get('start_date') 'product_id': request.args.get('product_id'),
end_date = request.args.get('end_date') 'start_date': request.args.get('start_date'),
'end_date': request.args.get('end_date'),
# Call the loan service 'due_before': request.args.get('due_before'),
result = LoanService.process_request( 'due_after': request.args.get('due_after')
customer_id=customer_id, }
loan_id=loan_id, # logger.info(f"Get loans request received with filters: {filters}")
status=status, response = LoanService.process_request(filters)
offer_id=offer_id, return response
product_id=product_id,
start_date=start_date,
end_date=end_date
)
return jsonify(result)
@api.route('/transactions', methods=['GET']) @api.route('/transactions', methods=['GET'])
@token_required # @token_required
def get_transactions(): def get_transactions():
# Extract query parameters # Extract query parameters for filtering
account_id = request.args.get('account_id') filters = {
transaction_id = request.args.get('transaction_id') 'account_id': request.args.get('account_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'),
end_date = request.args.get('end_date') 'end_date': request.args.get('end_date')
}
# Call the transaction service # logger.info(f"Get transactions request received with filters: {filters}")
result = TransactionService.process_request( response = TransactionService.process_request(filters)
account_id=account_id, return response
transaction_id=transaction_id,
type=type,
channel=channel,
start_date=start_date,
end_date=end_date
)
return jsonify(result)