receipts.resolveReceipt migrated to new schema
This commit is contained in:
parent
c251ad4977
commit
0e0dcbc024
@ -293,17 +293,16 @@ 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:
|
webpush.push_ntfy(title=f"Receipt '{receipt['receipt_id']}' Resolved", body=f"Receipt {receipt['receipt_id']} was completed by {user['username']}.")
|
||||||
receipt = postsqldb.ReceiptTable.update_receipt(conn, site_name, {'id': receipt_id, 'update': {'receipt_status': 'Resolved'}})
|
return jsonify({'error': False, "message": "Line Saved Succesfully"})
|
||||||
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!"})
|
return jsonify({'error': True, "message": "Something went wrong while saving line!"})
|
||||||
|
|
||||||
# added to database
|
# added to database
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user