Example #1
0
class PsnPriceHistoryModel(DB.Model):
    """model for one of your table"""
    __tablename__ = 'psn_price_history'

    id = DB.Column(DB.Integer, primary_key=True)
    game_id = DB.Column(DB.String(), unique=True)
    game_title = DB.Column(DB.String())
    chartPrices = DB.Column(JSON)
    chartBonusPrices = DB.Column(JSON)
    highest_price = DB.Column(DB.Float())
    lowest_price = DB.Column(DB.Float())
    plus_lowest_price = DB.Column(DB.Float())

    def __init__(self,
                 game_id=None,
                 game_title=None,
                 chartPrices=None,
                 chartBonusPrices=None,
                 highest_price=None,
                 lowest_price=None,
                 plus_lowest_price=None):
        self.game_id = game_id
        self.game_title = game_title
        self.chartPrices = chartPrices
        self.chartBonusPrices = chartBonusPrices
        self.highest_price = highest_price,
        self.lowest_price = lowest_price,
        self.plus_lowest_price = plus_lowest_price

    def __repr__(self):
        return '<PsnPriceHistoryModel: game_id {}>'.format(self.game_id)
Example #2
0
class Team(DB.Model):
    """
    Represents a team in our database

    :param uuid: the id of the team
    :param username: the username of the team
    :param password: the teams password
    :param balance: the balance of their account
    :param pub_key: public key for the jenkins builds
    :param private_key: key to identify teams
    """
    __tablename__ = 'teams'
    uuid = DB.Column(DB.Integer, primary_key=True)
    username = DB.Column(DB.String(64))
    password = DB.Column(DB.String(64))
    balance = DB.Column(DB.Float())
    pub_key = DB.Column(DB.String(2048))
    private_key = DB.Column(DB.String(2048))


    def __init__(self, uuid, username, password, balance, pub_key, private_key):
        self.uuid = uuid
        self.username = username
        self.password = password
        self.balance = balance
        self.pub_key = pub_key
        self.private_key = private_key

    def __repr__(self):
        return '<Team uuid={} balance={}>'.format(self.uuid, self.balance)