Messin with some other stuff
This commit is contained in:
23
src/main.py
23
src/main.py
@@ -3,6 +3,7 @@ import sqlite3
|
||||
from game_tables import GameService, GameTable
|
||||
from key_tables import KeyService, KeyTable
|
||||
import container_managment
|
||||
from database import SmartCursor
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -48,6 +49,28 @@ def get_tables():
|
||||
return jsonify([table.toJson() for table in tables])
|
||||
|
||||
|
||||
@app.route("/api/tables", methods=["POST"])
|
||||
def create_table():
|
||||
app.logger.info(request.get_json())
|
||||
app.logger.info(request.get_json()["table_name"])
|
||||
db = get_db()
|
||||
with SmartCursor(connection=db) as smartCursor:
|
||||
table = GameTable(
|
||||
game_table_id=0,
|
||||
game_table_name=request.get_json()["table_name"],
|
||||
game_table_link=request.get_json()["table_link"],
|
||||
active=False,
|
||||
docker_id=None,
|
||||
)
|
||||
app.logger.info(table._created)
|
||||
app.logger.info(table._updated)
|
||||
table.commit(smartCursor)
|
||||
app.logger.info(table._created)
|
||||
app.logger.info(table._updated)
|
||||
db.commit()
|
||||
return jsonify({}), 200
|
||||
|
||||
|
||||
@app.route("/api/tables/<table_id>")
|
||||
def get_table(table_id):
|
||||
gameService = GameService(get_db())
|
||||
|
||||
Reference in New Issue
Block a user