aboutsummaryrefslogtreecommitdiff
path: root/api/user/status.py
diff options
context:
space:
mode:
Diffstat (limited to 'api/user/status.py')
-rw-r--r--api/user/status.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/api/user/status.py b/api/user/status.py
new file mode 100644
index 0000000..e2895d5
--- /dev/null
+++ b/api/user/status.py
@@ -0,0 +1,27 @@
+from flask import Blueprint, request
+from db import cursor, connection
+from auth.login_token import token_login
+import json
+
+status = Blueprint('user_status', __name__)
+
+@status.route('/status', 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", status]
+