From 8467f11c67c7047a40cb8cadc623bb1788bb9585 Mon Sep 17 00:00:00 2001 From: Max Value Date: Fri, 18 Apr 2025 14:42:52 +0100 Subject: [PATCH] Added endpoint to get all data --- teleshopping.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(): -- 2.39.2