receipts.resolveReceipt migrated to new schema

This commit is contained in:
Jadowyne Ulve 2025-08-02 10:22:59 -05:00
parent c251ad4977
commit 0e0dcbc024

View File

@ -293,15 +293,14 @@ def postVendorUpdate():
return jsonify({'error': False, "message": "Line Saved Succesfully"}) return jsonify({'error': False, "message": "Line Saved Succesfully"})
return jsonify({'error': True, "message": "Something went wrong while saving line!"}) return jsonify({'error': True, "message": "Something went wrong while saving line!"})
# added to database
@receipt_api.route('/api/resolveReceipt', methods=["POST"]) @receipt_api.route('/api/resolveReceipt', methods=["POST"])
def resolveReceipt(): def resolveReceipt():
if request.method == "POST": if request.method == "POST":
receipt_id = int(request.get_json()['receipt_id']) receipt_id = int(request.get_json()['receipt_id'])
site_name = session['selected_site'] site_name = session['selected_site']
user= session['user'] user= session['user']
database_config = config() receipt = receipts_database.updateReceiptsTuple(site_name, {'id': receipt_id, 'update': {'receipt_status': 'Resolved'}})
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']}.") 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': False, "message": "Line Saved Succesfully"})
return jsonify({'error': True, "message": "Something went wrong while saving line!"}) return jsonify({'error': True, "message": "Something went wrong while saving line!"})