Example #1
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_viber_id = db.Column(db.String(150), unique=True)
    nickname = db.Column(db.String(50))
    quer = db.relationship('Query', backref='user', uselist=False)
    zakazi = db.relationship('Zakaz', backref='user', uselist=True)
    novaposhta = db.relationship('NP', backref='user', uselist=False)
    search = db.relationship('Search', backref='user', uselist=True)

    def __repr__(self):
        return f"User('{self.user_viber_id}')"
Example #2
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(255), nullable=False)
    weather_id = db.Column(db.Integer,
                           db.ForeignKey('weather.id'),
                           nullable=False)
    weather = db.relationship('Weather', backref=db.backref('user', lazy=True))
    horoscope_id = db.Column(db.Integer,
                             db.ForeignKey('horoscope.id'),
                             nullable=False)
    horoscope = db.relationship('Horoscope',
                                backref=db.backref('user', lazy=True))
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), index=True, unique=True)
    timeout = db.Column(db.DateTime)
    password_hash = db.Column(db.String(128))
    mumble_username = db.Column(db.String(128))
    admin = db.Column(db.Boolean, default=False)
    disabled = db.Column(db.Boolean, default=True)
    sounds = db.relationship('Sound', backref='owner', lazy='dynamic')
    sound_board_sounds = db.relationship('Sound', secondary='sound_board')

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)
Example #4
0
class PidorGame(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    is_active = db.Column(db.Boolean)

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    user = db.relationship('User',
                           backref=db.backref('pidor_games', lazy=True))
Example #5
0
class StatPidor(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    count = db.Column(db.Integer)

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    user = db.relationship('User',
                           backref=db.backref('stat_pidors', lazy=True))
class Sound(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    sound_name = db.Column(db.String(20), index=True)
    file_uuid = db.Column(db.String(36), index=True, unique=True)
    private = db.Column(db.Boolean)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    users = db.relationship('User', secondary='sound_board')
Example #7
0
class Player(db.Model):
    pid = db.Column(db.String, primary_key=True)
    name = db.Column(db.String(120), nullable=False)
    admin = db.Column(db.Boolean, nullable=False)
    num_activities = db.Column(db.Integer, nullable=False, default=0)
    attendance = db.relationship("Attendance", backref="player")

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        db.session.add(self)
        db.session.commit()

    @staticmethod
    def is_admin(pid):
        if player := Player.query.filter_by(pid=pid).first():
            return player.admin
        return False
Example #8
0
class Horoscope(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255))
    emoji_id = db.Column(db.Integer, db.ForeignKey('emoji.id'), nullable=False)
    emoji = db.relationship('Emoji',
                            backref=db.backref('horoscope', lazy=True))