Add in stuff for active/deactive
This commit is contained in:
29
src/main.py
29
src/main.py
@@ -41,5 +41,34 @@ def get_tables():
|
||||
|
||||
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__':
|
||||
app.run(debug=True)
|
||||
|
||||
Reference in New Issue
Block a user