Example #1
0
class BetScorer(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    scorer1_id = db.Column(db.Integer, db.ForeignKey('scorer.id'))
    scorer1 = db.relationship('Scorer', foreign_keys=scorer1_id)
    scorer2_id = db.Column(db.Integer, db.ForeignKey('scorer.id'))
    scorer2 = db.relationship('Scorer', foreign_keys=scorer2_id)
    created_at = db.Column(db.DateTime(), default=datetime.now)
    updated_at = db.Column(db.DateTime())
    score = db.Column(db.Integer, default=0)
Example #2
0
class BetGame(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    game_id = db.Column(db.Integer, db.ForeignKey('game.id'))
    game = db.relationship('Game', foreign_keys=game_id)
    score_team1 = db.Column(db.Integer)
    score_team2 = db.Column(db.Integer)
    created_at = db.Column(db.DateTime(), default=datetime.now)
    updated_at = db.Column(db.DateTime())
    score = db.Column(db.Integer, default=0)
    __table_args__ = (db.UniqueConstraint('user_id', 'game_id',
                                          name='uix_1'), )
Example #3
0
class Game(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    label = db.Column(db.String(50))
    group = db.Column(db.String(1))
    round = db.Column(db.Integer)
    time = db.Column(db.DateTime())
    place = db.Column(db.String(50))
    team1_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    team1 = db.relationship('Team', foreign_keys=team1_id)
    team2_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    team2 = db.relationship('Team', foreign_keys=team2_id)
    score_team1 = db.Column(db.Integer)
    score_team2 = db.Column(db.Integer)

    def __repr__(self):
        return u"%s vs %s" % (self.team1, self.team2)
Example #4
0
class BetChampions(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    first_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    first = db.relationship('Team', foreign_keys=first_id)
    second_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    second = db.relationship('Team', foreign_keys=second_id)
    third_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    third = db.relationship('Team', foreign_keys=third_id)
    fourth_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    fourth = db.relationship('Team', foreign_keys=fourth_id)
    created_at = db.Column(db.DateTime(), default=datetime.now)
    updated_at = db.Column(db.DateTime())
    score = db.Column(db.Integer, default=0)

    def __repr__(self):
        return "1-{0} 2-{1} 3-{2} 4-{3}".format(self.first, self.second,
                                                self.third, self.fourth)
Example #5
0
class Scorer(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80))
    image = db.Column(db.String(150))
    team_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    team = db.relationship('Team')
    scorer = db.Column(db.Boolean, default=False)

    def __repr__(self):
        return self.name