diff --git a/app/app.py b/app/app.py index f78d917..f622106 100644 --- a/app/app.py +++ b/app/app.py @@ -143,6 +143,25 @@ def salary_verifypin(): def salary_demousers(): dList = [] + + SELECT_DEMO_ENTRY = f"SELECT id,uid, name,offers,salary_account,current_loans,mobile,bvn, email, pin, added::text FROM demo_bank_accounts ORDER BY id ASC" +# 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() + + demo_data = json.dumps( [dict(ix) for ix in select_demoS] ) + result_demo_data = { + "last_update": datetime.datetime.utcnow(), + "offers":products(), + "list" : json.loads( demo_data) + } + return { + "demo_data": result_demo_data, + }, 200 + + # VARCHAR(125), # offers INT DEFAULT 0, # INT DEFAULT 0, @@ -171,15 +190,7 @@ def salary_demousers(): # # print(names.get_full_name()) - SELECT_DEMO_ENTRY = f"SELECT id,uid, name,offers,salary_account,current_loans,mobile,bvn, email, pin, added::text FROM demo_bank_accounts ORDER BY id ASC" -# 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() - -# print(select_demoS) - demo_data = json.dumps( [dict(ix) for ix in select_demoS] ) + # return jsonify(demo_data=demo_data) # print(demo_data) # sample_range = random.randint(2, 5) @@ -199,15 +210,7 @@ def salary_demousers(): # } # dList.append(new_l) - demo_data = { - "last_update": datetime.datetime.utcnow(), - "offers":products(), - "list" : json.loads( demo_data) - } - return { - "demo_data": demo_data, - }, 200 - # return jsonify(demo_data=demo_data) + @app.route('/salary/products') def salary_products(): @@ -220,7 +223,7 @@ def salary_products(): }, 200 @app.route('/salary/loanoffers') -def salary_loanoffers(): +def salary_loanoffers2(): offers_data = { "offers": offers() , "extra" : [] @@ -230,7 +233,7 @@ def salary_loanoffers(): }, 200 @app.route('/salary/loanselect', methods=["POST"]) -def salary_loanselect(): +def salary_loanselect2(): try: data = request.json if not data: @@ -272,7 +275,7 @@ def salary_loanselect(): @app.route('/salary/loanapply', methods=["POST"]) -def salary_loanapply(): +def salary_loanapply2(): try: data = request.json if not data: @@ -309,7 +312,7 @@ def salary_loanapply(): @app.route('/salary/verifloan', methods=["POST"]) -def salary_verifloan(): +def salary_verifloan2(): try: data = request.json if not data: