1
0
Fork 0
forked from bton/matekasse

api return fix

This commit is contained in:
2000-Trek 2023-06-21 20:44:12 +02:00
parent 880dce48f7
commit 5a954ecdae

10
main.py
View file

@ -261,21 +261,21 @@ def get_id():
finished = queue_item finished = queue_item
return make_response(json.dumps({"mode":"0","error":"170"})) return make_response(json.dumps({"mode":"0","error":"170"}))
else: else:
c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, {user})") c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, {user[1]})")
message = tag_id message = tag_id
finished = queue_item finished = queue_item
c.execute(f"SELECT * FROM users WHERE id={user}") c.execute(f"SELECT * FROM users WHERE id={user[1]}")
username = c.fetchall() username = c.fetchall()
conn.commit() conn.commit()
return make_response(json.dumps({"mode":"2","username":username,"code":"1"})) return make_response(json.dumps({"mode":"2","username":username,"code":"1"}))
elif state == "remove": elif state == "remove":
c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user})") c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user[1]})")
tags = c.fetchall() tags = c.fetchall()
if tags != []: if tags != []:
c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = {user}) ") c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = {user[1]}) ")
message = tag_id message = tag_id
finished = queue_item finished = queue_item
c.execute(f"SELECT * FROM users WHERE id={user}") c.execute(f"SELECT * FROM users WHERE id={user[1]}")
username = c.fetchall() username = c.fetchall()
conn.commit() conn.commit()
return make_response(json({"mode":"2","username":username,"code":"2"})) return make_response(json({"mode":"2","username":username,"code":"2"}))