From 3e28c7cf32c764f2acf796f8ef2f74dead762974 Mon Sep 17 00:00:00 2001 From: ameye Date: Sun, 27 Apr 2025 07:43:55 -0400 Subject: [PATCH] Protected the load users --- app/app.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/app/app.py b/app/app.py index 3fe1765..a105eda 100644 --- a/app/app.py +++ b/app/app.py @@ -144,25 +144,29 @@ def salary_verifypin(): @app.route('/salary/demousers') def salary_demousers(): - dList = [] - - SELECT_DEMO_ENTRY = f"SELECT id,uid, bvn AS CustomerID, mobile AS AccountID, name,offers,salary_account,current_loans,mobile,bvn, email, pin, added::text, balance, updated::text AS updated FROM demo_bank_accounts ORDER BY id DESC LIMIT 1500" -# print(SELECT_DEMO_ENTRY) - with connection: + try: + SELECT_DEMO_ENTRY = f"SELECT id,uid, bvn AS CustomerID, mobile AS AccountID, name,offers,salary_account,current_loans,mobile,bvn, email, pin, added::text, balance, updated::text AS updated FROM demo_bank_accounts ORDER BY id DESC LIMIT 1500" + print(SELECT_DEMO_ENTRY) + with connection: with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: cursor.execute(SELECT_DEMO_ENTRY) select_demoS = cursor.fetchall() -# "last_update": datetime.datetime.utcnow(),# - demo_data = json.dumps( [dict(ix) for ix in select_demoS] ) - result_demo_data = { - "last_update": "2010-01-01", - "offers":products(), - "list" : json.loads( demo_data) - } - return { - "demo_data": result_demo_data, - }, 200 + # "last_update": datetime.datetime.utcnow(),# + demo_data = json.dumps([dict(ix) for ix in select_demoS]) + result_demo_data = { + "last_update": "2010-01-01", + "offers": products(), + "list": json.loads(demo_data) + } + return { + "demo_data": result_demo_data, + }, 200 + except Exception as e: + return { + "demo_data": [], + }, 200 + # VARCHAR(125),