예제 #1
0
    def delete(self, user_id):
        app.logger.info("Deleting User #: " + user_id)
        user = User.query.filter_by(id=user_id).first()
        db_session.delete(user)
        db_session.commit()

        return {"meta": buildMeta(), "data": None}
예제 #2
0
    def tearDown(self):
        #Bill.query.filter(models.User.first_name=self.get_default_test_name()).delete()
        for row in User.query.filter_by(first_name=self.get_default_test_name(), last_name=self.get_default_test_name()):
            db_session.delete(row)

        db_session.commit()
        db_session.remove()
        self.logout()
예제 #3
0
    def delete(self, bill_id):

        if 'username' in session:
            user = User.query.filter_by(username=session['username']).first()
        if user is None:
            return {"meta": buildMeta(), "error": "No Session Found"}

        app.logger.info("Deleting Bill #: " + bill_id)
        bill = Bill.query.filter_by(id=bill_id, user_id=user.id).first()
        if bill is not None:
            db_session.delete(bill)
            db_session.commit()
            return {"meta": buildMeta(), "data": None}
        else:
            return {"meta": buildMeta(), "error": "Bill #" + bill_id + " Could not be found", "data": None}