class User(Base): iduser = db.Column(db.INTEGER, primary_key=True, autoincrement=True) username = db.Column(db.VARCHAR(45)) firstname = db.Column(db.VARCHAR(45)) password = db.Column(db.VARCHAR(128)) lastname = db.Column(db.VARCHAR(45)) def __init__(self, iduser, username, firstname, password, lastname): self.iduser = iduser self.username = username self.firstname = firstname self.password = password self.lastname = lastname
class Credit(Base): idcredit = db.Column(db.INTEGER, primary_key=True, autoincrement=True) startDate = db.Column(db.DATETIME) finishDate = db.Column(db.DATETIME) sum = db.Column(db.INTEGER) percent = db.Column(db.INTEGER) status = db.Column(db.VARCHAR(45)) userId = db.Column(db.INTEGER, db.ForeignKey(User.iduser)) bankId = db.Column(db.INTEGER, db.ForeignKey(Bank.idbank))
class Finances(Base): __tablename__ = "finances" id_fin = db.Column(db.INTEGER, primary_key=True) item = db.Column(db.VARCHAR(45)) price = db.Column(db.INTEGER) date = db.Column(db.DATETIME(10)) account_id = db.Column(db.INTEGER, db.ForeignKey(Account.id_account)) Account = db.relationship(Account) status = db.Column(db.VARCHAR(45)) def get_finances(self): result = { 'id': self.id_fin, 'item': self.item, 'price': self.price, 'date': self.date, 'status': self.status } return result
class User(Base): __tablename__ = "user" id_user = db.Column(db.INTEGER, primary_key=True) username = db.Column(db.VARCHAR(45), nullable=True) firstname = db.Column(db.VARCHAR(45)) lastname = db.Column(db.VARCHAR(45)) email = db.Column(db.VARCHAR(45)) password = db.Column(db.VARCHAR(45), nullable=True) phone = db.Column(db.VARCHAR(45)) account_id = db.Column(db.INTEGER, db.ForeignKey(Account.id_account)) Account = db.relationship(Account) family_id = db.Column(db.INTEGER, db.ForeignKey(Family.id_family), nullable=True) Family = db.relationship(Family) def get_users(self): result = { 'id': self.id_user, 'username': self.username, 'password': self.password, 'family id': self.family_id, 'account id': self.account_id } return result def get_users2(self): result = { 'id': self.id_user, 'username': self.username, 'family id': self.family_id, 'account id': self.account_id } return result
class User(Base): __tablename__ = "user" id_user = db.Column(db.INTEGER, primary_key=True) username = db.Column(db.VARCHAR(45), nullable=True) firstname = db.Column(db.VARCHAR(45)) lastname = db.Column(db.VARCHAR(45)) email = db.Column(db.VARCHAR(45)) password = db.Column(db.VARCHAR(45), nullable=True) phone = db.Column(db.VARCHAR(45)) account_id = db.Column(db.INTEGER, db.ForeignKey(Account.id_account)) Account = db.relationship(Account) family_id = db.Column(db.INTEGER, db.ForeignKey(Family.id_family), nullable=True) Family = db.relationship(Family)
class Family(Base): __tablename__ = "family" id_family = db.Column(db.INTEGER, primary_key=True) surname = db.Column(db.VARCHAR(45), nullable=True) budget = db.Column(db.INTEGER)
class Bank(Base): idbank = db.Column(db.INTEGER, primary_key=True, autoincrement=True) name = db.Column(db.VARCHAR(45)) budget = db.Column(db.INTEGER)