Merge pull request #16 from sorrelbri/sj-serve-game
serve basic game data
This commit is contained in:
commit
63982a2615
2 changed files with 9 additions and 1 deletions
|
@ -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():
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue