From c4ac25bbdd3cb15bc84b448826c62797887f2a3a Mon Sep 17 00:00:00 2001 From: Azeez Muibi Date: Thu, 17 Apr 2025 17:34:20 +0100 Subject: [PATCH] update --- app/api/routes/routes.py | 72 ++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index d5820ae..245ce07 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -61,7 +61,7 @@ def login(): @api.route('/dashboard', methods=['GET']) -@token_required +# @token_required def get_dashboard(): # Call the dashboard service result = DashboardService.get_dashboard_data() @@ -69,50 +69,36 @@ def get_dashboard(): @api.route('/loans', methods=['GET']) -@token_required +# @token_required def get_loans(): - # Extract query parameters - customer_id = request.args.get('customer_id') - loan_id = request.args.get('loan_id') - status = request.args.get('status') - offer_id = request.args.get('offer_id') - product_id = request.args.get('product_id') - start_date = request.args.get('start_date') - end_date = request.args.get('end_date') - - # Call the loan service - result = LoanService.process_request( - customer_id=customer_id, - loan_id=loan_id, - status=status, - offer_id=offer_id, - product_id=product_id, - start_date=start_date, - end_date=end_date - ) - - return jsonify(result) + # Extract query parameters for filtering + filters = { + 'customer_id': request.args.get('customer_id'), + 'account_id': request.args.get('account_id'), + 'status': request.args.get('status'), + 'offer_id': request.args.get('offer_id'), + 'product_id': request.args.get('product_id'), + 'start_date': request.args.get('start_date'), + 'end_date': request.args.get('end_date'), + 'due_before': request.args.get('due_before'), + 'due_after': request.args.get('due_after') + } + # logger.info(f"Get loans request received with filters: {filters}") + response = LoanService.process_request(filters) + return response @api.route('/transactions', methods=['GET']) -@token_required +# @token_required def get_transactions(): - # Extract query parameters - account_id = request.args.get('account_id') - transaction_id = request.args.get('transaction_id') - type = request.args.get('type') - channel = request.args.get('channel') - start_date = request.args.get('start_date') - end_date = request.args.get('end_date') - - # Call the transaction service - result = TransactionService.process_request( - account_id=account_id, - transaction_id=transaction_id, - type=type, - channel=channel, - start_date=start_date, - end_date=end_date - ) - - return jsonify(result) \ No newline at end of file + # Extract query parameters for filtering + filters = { + 'account_id': request.args.get('account_id'), + 'type': request.args.get('type'), + 'channel': request.args.get('channel'), + 'start_date': request.args.get('start_date'), + 'end_date': request.args.get('end_date') + } + # logger.info(f"Get transactions request received with filters: {filters}") + response = TransactionService.process_request(filters) + return response \ No newline at end of file