From 214050ea8a60250e4d3cd85376ac49fcc1c4abc8 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Wed, 5 Feb 2025 11:44:40 -0500 Subject: [PATCH] New api data --- app/app.py | 45 +++++++++++++++++++++++++++++++++++++++++--- app/requirements.txt | 3 ++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/app/app.py b/app/app.py index bf57491..8e8c561 100644 --- a/app/app.py +++ b/app/app.py @@ -1,6 +1,16 @@ -from flask import Flask +# from flask import Flask from flask_swagger_ui import get_swaggerui_blueprint - +import datetime +import jwt +import random +import json +import names +from flask import ( + Flask, + jsonify, + send_from_directory, + request, +) app = Flask(__name__) SWAGGER_URL = '/api/docs' # URL for exposing Swagger UI (without trailing '/') @@ -66,7 +76,36 @@ def salary_login(): @app.route('/salary/demousers') def salary_demousers(): - return "Hello World!" + dList = [] + for i in range(10): + print(names.get_full_name()) + + sample_range = random.randint(20, 60) + for x in range(sample_range): + calDate = datetime.datetime.utcnow() + datetime.timedelta(minutes=180 * random.randint(1, 20)) + new_l = { + "uid":"425611f2-c692-4404-b93d-76ca7a5ce7"+str(x), + "name": names.get_full_name() , + "added": calDate, "offers":random.randint(1, 4), + "mobile": '801-000-'+str( random.randint(1000, 9999) ) , + "bvn": '8315000'+str( random.randint(1000, 9999) ), + "email": 'jerry@example.com' , + "current_loans" : [], + "salary_account": random.randint(0, 1) + } + dList.append(new_l) + + demo_data = { + "last_update": datetime.datetime.utcnow(), + "offers": [ + {"cid": "1", "description": "Product Loan 01" }, + {"cid": "2", "description": "Product Loan 02" }, + {"cid": "3", "description": "Product Loan 03" }, + {"cid": "4", "description": "Product Loan 04" }, + ], + "list" : dList + } + return jsonify(demo_data=demo_data) if __name__ == '__main__': diff --git a/app/requirements.txt b/app/requirements.txt index 6685afc..aa731a3 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -13,4 +13,5 @@ sqlalchemy flask-socketio Flask-Mail pycountry -flask-swagger-ui \ No newline at end of file +flask-swagger-ui +names \ No newline at end of file