def delete(self, id): args = self.reqparse.parse_args(strict=True) abort_if_no_auth(args['token']) game = Game.query.get_or_404(id) db.session.delete(game) db.session.commit() return "", 204
def put(self, id): args = self.reqparse.parse_args(strict=True) abort_if_no_auth(args['token']) game = Game.query.get_or_404(id) game.developer_id = args['developer_id'] db.session.commit() return {"result": game.id}, 201
def post(self): args = self.reqparse.parse_args(strict=True) abort_if_no_auth(args['token']) new_game = Game(args['title']) db.session.add(new_game) db.session.commit() return {"result": new_game.id}, 201
def post(self): args = self.reqparse.parse_args(strict=True) abort_if_no_auth(args['token']) new_category = Category(args['name']) db.session.add(new_category) db.session.commit() return {"result": new_category.id}, 201
def put(self, id): args = self.reqparse.parse_args(strict=True) abort_if_no_auth(args['token']) category = Category.query.get_or_404(id) if args['name']: category.name = args['name'] db.session.commit() return {"result": category.id}, 201