Exemple #1
0
class BankAccount(Model):
    __tablename__ = 'jhi_bank_account'

    name = db.Column(db.String)
    balance = db.Column(db.Float)
    user_id = db.Column(db.Integer, db.ForeignKey('jhi_user.id'))

    user = db.relationship('User',
                           backref=db.backref('accounts', lazy='dynamic'))
Exemple #2
0
class Operation(Model):
    __tablename__ = "jhi_operation"

    date = db.Column(db.DateTime, nullable=False)
    description = db.Column(db.String)
    amount = db.Column(db.Float, nullable=False)
    bank_account_id = db.Column(db.Integer,
                                db.ForeignKey('jhi_bank_account.id'))

    bank_account = db.relationship('BankAccount',
                                   backref=db.backref('operations',
                                                      lazy='dynamic'))
    labels = db.relationship('Label',
                             secondary=operation_label_table,
                             backref=db.backref('operations', lazy='dynamic'))
Exemple #3
0
def ReferenceCol(tablename, nullable=False, **kw):
    return db.Column(db.ForeignKey("%s.id" % tablename), nullable=nullable, **kw)
Exemple #4
0
import datetime

from sample_app import db, bc
from utils.data import Model

user_authority_table = db.Table(
    "jhi_user_authority",
    db.Column("user_id",
              db.Integer,
              db.ForeignKey('jhi_user.id'),
              nullable=False),
    db.Column("authority_name",
              db.String(50),
              db.ForeignKey('jhi_authority.name'),
              nullable=False),
    db.PrimaryKeyConstraint('user_id', 'authority_name'))


class User(Model):
    __tablename__ = 'jhi_user'

    uid = db.Column(db.Integer, key="id", primary_key=True)
    login = db.Column(
        "login", db.String(50), unique=True,
        nullable=False)  # TODO: have a validator regex for login!
    password = db.Column("password_hash", db.String(60))
    first_name = db.Column("first_name", db.String(50))
    last_name = db.Column("last_name", db.String(50))
    email = db.Column("email", db.String(191))
    image_url = db.Column("image_url", db.String(256))
    activated = db.Column("activated", db.Boolean)
Exemple #5
0
    user = db.relationship('User',
                           backref=db.backref('accounts', lazy='dynamic'))


class Label(Model):
    __tablename__ = 'jhi_label'

    label = db.Column(db.String)


operation_label_table = db.Table(
    "jhi_operation_label",
    db.Column("operation_id",
              db.Integer,
              db.ForeignKey('jhi_operation.id'),
              nullable=False),
    db.Column("label_id",
              db.Integer,
              db.ForeignKey('jhi_label.id'),
              nullable=False),
    db.PrimaryKeyConstraint('operation_id', 'label_id'))


class Operation(Model):
    __tablename__ = "jhi_operation"

    date = db.Column(db.DateTime, nullable=False)
    description = db.Column(db.String)
    amount = db.Column(db.Float, nullable=False)
    bank_account_id = db.Column(db.Integer,