def delete(self, play_id): erase_play = Play.query.get_or_404(play_id) erase_play.delete_play() clear_cache("/plays") return {"message": "play deleted"}, HTTPStatus.NO_CONTENT
def delete(self, player_id): erase_player = Player.query.get_or_404(player_id) db.session.delete(erase_player) db.session.commit() clear_cache("/players") return {"message": "user deleted"}, HTTPStatus.NO_CONTENT
def delete(self, game_id): game_erase = Game.query.get_or_404(game_id) db.session.delete(game_erase) db.session.commit() clear_cache("/games") return {"message": "game deleted"}, HTTPStatus.NO_CONTENT
def put(self, play_id): play_schema = PlaySchema(partial=True) modify_play = Play.query.get_or_404(play_id) modify_play = play_schema.load(request.json, instance=modify_play) db.session.commit() clear_cache("/plays") return { "message": "play updated", "play": play_schema.dump(modify_play), }, HTTPStatus.OK
def put(self, player_id): player_schema = PlayerSchema(partial=True) player = Player.query.get_or_404(player_id) player = player_schema.load(request.json, instance=player) db.session.commit() clear_cache("/players") return { "message": "player updated", "player": player_schema.dump(player), }, HTTPStatus.OK
def put(self, game_id): game_schema = GameSchema(partial=True) game = Game.query.get_or_404(game_id) game = game_schema.load(request.json, instance=game) db.session.commit() clear_cache("/games") return { "message": "game updated", "game": game_schema.dump(game), }, HTTPStatus.OK