serve basic game data

This commit is contained in:
Sorrel Bri 2019-10-11 11:55:35 -07:00
parent e1f97d9cab
commit e378697974
2 changed files with 9 additions and 1 deletions

View file

@ -11,6 +11,14 @@ from websockets.socket import new_game_notice
api_games = Blueprint('api_games', __name__, url_prefix='/api/games') api_games = Blueprint('api_games', __name__, url_prefix='/api/games')
@api_games.route('/<game_id>', methods=['GET'])
def get_room(game_id):
print(game_id)
game = Game.query.filter_by(id=game_id).first()
response = game_schema.dumps(game)
# join_game_notice(game_id)
return jsonify(response)
@api_games.route('/', methods=['POST']) @api_games.route('/', methods=['POST'])
@jwt_required() @jwt_required()
def post_game(): def post_game():

View file

@ -77,7 +77,7 @@ class GameSchema(ma.ModelSchema):
id = fields.Int() id = fields.Int()
name = fields.Str() name = fields.Str()
description = fields.Str() description = fields.Str()
boardSize = fields.Int() board_size = fields.Int()
player = fields.Nested(user_schema) player = fields.Nested(user_schema)
game_schema = GameSchema() game_schema = GameSchema()