Exemplo n.º 1
0
class Bonds(db.Model):
    __tablename__ = 'bonds'
    __table_args__ = {'extend_existing': True}

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True)
    bond_id = db.Column(db.Integer, db.ForeignKey('bond.id'), primary_key=True)
    quantity = db.Column(db.Integer, nullable=False)
    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now())

    owner = db.relationship("User", backref="bond_owner")
    bond = db.relationship("Bond", backref="bond")
Exemplo n.º 2
0
class Terms(db.Model):
    __tablename__ = 'terms'
    __table_args__ = {'extend_existing': True}

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True)
    term_id = db.Column(db.Integer, db.ForeignKey('term.id'), primary_key=True)
    balance = db.Column(db.Numeric(20, 2), nullable=False)
    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now())

    owner = db.relationship("User", backref="term_owner")
    term = db.relationship("Term", backref="term")
Exemplo n.º 3
0
class Sells(db.Model):
    __tablename__ = 'sells'
    __table_args__ = {'extend_existing': True}

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True)
    bond_id = db.Column(db.Integer, db.ForeignKey('bond.id'), primary_key=True)
    quantity = db.Column(db.Integer, nullable=False)
    offer = db.Column(db.Numeric(6, 2), nullable=False)
    rate = db.Column(db.Numeric(4, 2), nullable=True)
    yd = db.Column(db.Numeric(4, 4), nullable=False)

    seller = db.relationship("User", backref="seller")
    bond = db.relationship("Bond", backref="bond_sell")
Exemplo n.º 4
0
class Sends(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now())
    note = db.Column(db.String(60), nullable=True)
    amount = db.Column(db.Numeric(20, 2), nullable=False)
    t_transaction = db.Column(db.Boolean, default=False, nullable=False)
    b_transaction = db.Column(db.Boolean, default=False, nullable=False)
    receiver = db.Column(db.Integer, nullable=False)
    balance = db.Column(db.Numeric(20, 2), nullable=False)
    sender_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
Exemplo n.º 5
0
class Messages(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now())
    receiver = db.Column(db.Integer, nullable=False)
    message = db.Column(db.String(300), nullable=False)
    sender_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)
Exemplo n.º 6
0
class Statuses(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.now())
    status = db.Column(db.String(), nullable=False)
    poster_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)