diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index 8292111..b845993 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -734,6 +734,7 @@ def myproduct(current_user): @token_required def subscription_start(current_user): print( current_user ) + #{'user': {'id': 5, 'member_id': 5, 'uid': '1f92e1ae-c084-4622-9e7c-dfeedf698c58'}, 'exp': 1736713281} data = request.json product_id = data.get('product_id') if not product_id: @@ -755,8 +756,12 @@ def subscription_start(current_user): if product_found == 0 : return jsonify({'status': "INVALID",'message': 'Error - Invalid product'}), 403 - - + member_id = current_user['user']['member_id'] + INSERT_NEW_PRODUCT ="INSERT INTO members_products (member_id ,product_id) VALUES (%s, %s)" + val_insert = (member_id, product_id) + with connection: + with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor: + cursor.execute(INSERT_NEW_PRODUCT,val_insert) print(product_id)