From 0e0dcbc024bbfcc65ad1e9dc9d86da266c3b26bb Mon Sep 17 00:00:00 2001 From: Jadowyne Ulve Date: Sat, 2 Aug 2025 10:22:59 -0500 Subject: [PATCH] receipts.resolveReceipt migrated to new schema --- application/receipts/receipts_api.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/receipts/receipts_api.py b/application/receipts/receipts_api.py index f32cae0..0b2529e 100644 --- a/application/receipts/receipts_api.py +++ b/application/receipts/receipts_api.py @@ -293,17 +293,16 @@ def postVendorUpdate(): return jsonify({'error': False, "message": "Line Saved Succesfully"}) return jsonify({'error': True, "message": "Something went wrong while saving line!"}) +# added to database @receipt_api.route('/api/resolveReceipt', methods=["POST"]) def resolveReceipt(): if request.method == "POST": receipt_id = int(request.get_json()['receipt_id']) site_name = session['selected_site'] user= session['user'] - database_config = config() - with psycopg2.connect(**database_config) as conn: - receipt = postsqldb.ReceiptTable.update_receipt(conn, site_name, {'id': receipt_id, 'update': {'receipt_status': 'Resolved'}}) - webpush.push_ntfy(title=f"Receipt '{receipt['receipt_id']}' Resolved", body=f"Receipt {receipt['receipt_id']} was completed by {user['username']}.") - return jsonify({'error': False, "message": "Line Saved Succesfully"}) + receipt = receipts_database.updateReceiptsTuple(site_name, {'id': receipt_id, 'update': {'receipt_status': 'Resolved'}}) + webpush.push_ntfy(title=f"Receipt '{receipt['receipt_id']}' Resolved", body=f"Receipt {receipt['receipt_id']} was completed by {user['username']}.") + return jsonify({'error': False, "message": "Line Saved Succesfully"}) return jsonify({'error': True, "message": "Something went wrong while saving line!"}) # added to database