Add in stuff for active/deactive

This commit is contained in:
iamBadgers
2026-03-22 16:35:11 -07:00
parent 240daa4278
commit de7c604f91

View File

@@ -41,5 +41,34 @@ def get_tables():
return jsonify([convert(x) for x in v]) return jsonify([convert(x) for x in v])
@app.route("/api/tables/<table_id>:start")
def activate_table(table_id):
db = get_db()
c = db.execute('select * from game_keys where game_table_id is null')
v = c.fetchall()
c.close()
if (len(v) == 0):
return "No more unused keys", 400
c = db.execute('select game_table_id as id, game_table_name, game_table_link, active from game_tables')
v = c.fetchall()
c.close()
if (len(v) == 0):
return "No such table", 404
table = convert(v[0])
if (table["active"]):
return "Table already active", 400
return jsonify(v)
@app.route("/api/tables/<table_id>:stop")
def deactivate_table(table_id):
return
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)