From 9690fc0e4a319941f3103b1c43d8509c22c20a4f Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Tue, 2 Jul 2024 16:47:39 +0200 Subject: slight improvements --- dashboard_website/dashboard.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'dashboard_website/dashboard.py') diff --git a/dashboard_website/dashboard.py b/dashboard_website/dashboard.py index b9b8bbc..90bd718 100644 --- a/dashboard_website/dashboard.py +++ b/dashboard_website/dashboard.py @@ -180,6 +180,22 @@ def visitGeneric(): return jsonify({'status' : f"ERROR {result}"}) return jsonify({'status' : "OK"}) +@app.route("/enableClue", methods=['POST']) +# Expected JSON +# {"clue_name" : xxxx, str} +# Returns JSON +# {"status" : "OK"/"ERROR XX" } +# ERROR CODES: 1 = missing fields, 2 = clue doesn't exist, 3 = already marked as visited +def enableClueToggle(): + content = request.get_json() + if not ('clue_name' in content): + return jsonify({'status' : "ERROR 1"}) + + result = db.toggleEnableClue(content['clue_name']) + if result != 0: + return jsonify({'status' : f"ERROR {result}"}) + return jsonify({'status' : "OK"}) + # # WEB / DASHBOARD API # @@ -223,7 +239,7 @@ def addClueWeb(): if not ('clue_name' in content and 'longitude' in content and 'latitude' in content and 'clue_info' in content): return jsonify({'status' : "ERROR 1"}) - + #db.addClue() return jsonify({'status' : "OK",}) -- cgit v1.2.3