aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-11 18:21:10 +0100
committerlonkaars <l.leblansch@gmail.com>2021-03-11 18:21:10 +0100
commitb34662346733ded378b31d8b1ba1e8b2953ec49a (patch)
tree94f39f81b5d86676beede5d5e0f48427aa3e746f /api
parent21d7703c679c85929abea1ac01ef22a83ebf4404 (diff)
can edit status now :tada:
Diffstat (limited to 'api')
-rw-r--r--api/user/updateStatus.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/api/user/updateStatus.py b/api/user/updateStatus.py
new file mode 100644
index 0000000..de32e95
--- /dev/null
+++ b/api/user/updateStatus.py
@@ -0,0 +1,27 @@
+from flask import Blueprint, request
+from db import cursor, connection
+from auth.login_token import token_login
+import json
+
+updateStatus = Blueprint('updateStatus', __name__)
+
+@updateStatus.route('/updateStatus', methods = ['POST'])
+def index():
+ data = request.get_json()
+
+ status = data.get("status") or ""
+ token = request.cookies.get("token") or ""
+
+ if not token: return "", 401
+ login = token_login(token) or ""
+
+ if not login: return "", 403
+ if not status: return "", 400
+
+ cursor.execute("update users set status = ? where user_id = ?", [status[0:200], login])
+ connection.commit()
+
+ return "", 200
+
+dynamic_route = ["/user", updateStatus]
+