Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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
Ejemplo n.º 5
0
    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