From bfbe9bed6dbf2e9bf911e828a5f7f0cd844ccd35 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Fri, 10 Jan 2025 06:59:06 -0500 Subject: [PATCH] Product test --- services/web/project/__init__.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index db55fde..bc960e8 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -734,14 +734,32 @@ def myproduct(current_user): def subscription_start(current_user): data = request.json product_id = data.get('product_id') - #request.args.get('product_id') - print(product_id) if not product_id: return { "message": "Please provide product_id", "data": None, "error": "Bad request" - }, 400 + }, 400 + + #request.args.get('product_id') + FIND_PRODUCT= "SELECT uid,product_id,name,description,banner,status FROM products WHERE product_id='"+product_id+"'" + with connection: + with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: + cursor.execute(FIND_PRODUCT) + product = cursor.fetchall() + print(product[0]["uid"]) + + product_found = count = len( product ) + if product_found == 0 : + return jsonify({'status': "INVALID",'message': 'Error - Invalid product'}), 403 + + +# if not product_id: +# return { +# "message": "Please provide product_id", +# "data": None, +# "error": "Bad request" +# }, 400 print(product_id) myproduct_data = []