From: Max Value Date: Fri, 18 Apr 2025 13:42:52 +0000 (+0100) Subject: Added endpoint to get all data X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=8467f11c67c7047a40cb8cadc623bb1788bb9585;p=shopping-channel Added endpoint to get all data --- diff --git a/teleshopping.py b/teleshopping.py index e78d1cb..07f87c2 100755 --- a/teleshopping.py +++ b/teleshopping.py @@ -300,6 +300,21 @@ def buy_data(): return jsonify(data) +@app.route("/api/buy/all") +@auth.login_required +def buy_all(): + data = [] + with sqlite3.connect(path.join(app.root_path, "data.db")) as connection: + cursor = connection.cursor() + + for order in cursor.execute(f""" + SELECT * + FROM orders; + """): + data.append(order[1]) + + return jsonify(data) + @app.route("/api/buy/clear") @auth.login_required def buy_clear():