diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-03-12 08:55:40 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-03-12 08:55:40 +0100 |
commit | 599108b21979039117ffe1de1817e71644a20fb4 (patch) | |
tree | 3a123627478a5280aeaf65910cbbe6b767f2987f /api/user/status.py | |
parent | b34662346733ded378b31d8b1ba1e8b2953ec49a (diff) |
cleaner endpoint names
Diffstat (limited to 'api/user/status.py')
-rw-r--r-- | api/user/status.py | 27 |
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] + |