class SystemConfig(db.Model):
    """SytemConfig is a table with various configuration options that are coded into the db"""
    sid = db.Column(db.Integer(),
                    db.Sequence('sid', start=1, increment=1),
                    primary_key=True)
    block_clients_below_version_android = db.Column(
        'block_clients_below_version_android',
        db.String(100),
        nullable=True,
        primary_key=False)
    block_clients_below_version_ios = db.Column(
        'block_clients_below_version_ios',
        db.String(100),
        nullable=True,
        primary_key=False)
    update_available_below_version_android = db.Column(
        'update_available_below_version_android',
        db.String(100),
        nullable=True,
        primary_key=False)
    update_available_below_version_ios = db.Column(
        'update_available_below_version_ios',
        db.String(100),
        nullable=True,
        primary_key=False)
    categories_extra_data = db.Column(
        db.JSON)  # all sorts of extra global data pertaining to categories
    current_picture_index = db.Column(db.Integer(),
                                      nullable=True,
                                      primary_key=False)
示例#2
0
class P2PTransaction(db.Model):
    """
    p2p transactions: between users
    """
    sender_user_id = db.Column('sender_user_id',
                               UUIDType(binary=False),
                               db.ForeignKey("user.user_id"),
                               unique=False,
                               nullable=False)
    receiver_user_id = db.Column('receiver_user_id',
                                 UUIDType(binary=False),
                                 db.ForeignKey("user.user_id"),
                                 unique=False,
                                 nullable=False)
    tx_hash = db.Column(db.String(100), nullable=False, primary_key=True)
    amount = db.Column(db.Integer(), nullable=False, primary_key=False)
    sender_address = db.Column(db.String(60),
                               db.ForeignKey("user.public_address"),
                               nullable=False,
                               unique=False)
    receiver_address = db.Column(db.String(60),
                                 db.ForeignKey("user.public_address"),
                                 nullable=False,
                                 unique=False)
    update_at = db.Column(db.DateTime(timezone=True),
                          server_default=db.func.now(),
                          onupdate=db.func.now())

    def __repr__(self):
        return '<p2ptx_hash: %s, sender_user_id: %s, receiver_user_id: %s, ' \
               'amount: %s, sender_address: %s, receiver_address: %s, update_at: %s>' % (self.tx_hash, self.sender_user_id, self.receiver_user_id,
                                                                                        self.amount, self.sender_address, self.receiver_address, self.update_at)
示例#3
0
class Transaction(db.Model):
    """
    Tippic transactions: from and to the server
    """
    tx_hash = db.Column(db.String(100), nullable=False, primary_key=True)
    user_id = db.Column('user_id',
                        UUIDType(binary=False),
                        db.ForeignKey("user.user_id"),
                        primary_key=False,
                        nullable=False)
    to_address = db.Column(db.String(60),
                           primary_key=False,
                           unique=False,
                           nullable=False)
    amount = db.Column(db.Integer(), nullable=False, primary_key=False)
    tx_for_item_id = db.Column(db.String(100),
                               nullable=False,
                               primary_key=False)
    tx_type = db.Column(db.String(20),
                        primary_key=False,
                        unique=False,
                        nullable=False)
    update_at = db.Column(db.DateTime(timezone=True),
                          server_default=db.func.now(),
                          onupdate=db.func.now())

    def __repr__(self):
        return '<tx_hash: %s, type: %s, user_id: %s, amount: %s, to_address: %s, tx_for_item_id: %s,  update_at: %s>' % \
               (self.tx_hash, self.tx_type, self.user_id, self.amount, self.to_address, self.tx_for_item_id,
                self.update_at)
示例#4
0
class BackupQuestion(db.Model):
    """the BackupQuestion model represents a single backup question. these are essentially hardcoded into the db.
    """
    sid = db.Column(db.Integer(), db.Sequence('sid', start=1, increment=1), primary_key=True)
    question_text = db.Column('question_text', db.String(300), unique=True)
    updated_at = db.Column(db.DateTime(timezone=True), server_default=db.func.now(), onupdate=db.func.now())

    def __repr__(self):
        return '<sid: %s, question_text: %s' \
               ' updated_at: %s>' % (self.sid, self.question_text, self.updated_at)
示例#5
0
class User(db.Model):
    """
    the user model
    """
    sid = db.Column(db.Integer(),
                    db.Sequence('sid', start=1, increment=1),
                    primary_key=False)
    user_id = db.Column(UUIDType(binary=False),
                        primary_key=True,
                        nullable=False)
    username = db.Column(db.String(40), primary_key=False, nullable=True)
    os_type = db.Column(db.String(10), primary_key=False, nullable=False)
    device_model = db.Column(db.String(DEVICE_MODEL_MAX_SIZE),
                             primary_key=False,
                             nullable=False)
    push_token = db.Column(db.String(200), primary_key=False, nullable=True)
    time_zone = db.Column(db.Integer(), primary_key=False, nullable=False)
    device_id = db.Column(db.String(40), primary_key=False, nullable=True)
    created_at = db.Column(db.DateTime(timezone=True),
                           server_default=db.func.now())
    onboarded = db.Column(db.Boolean, unique=False, default=False)
    public_address = db.Column(db.String(60),
                               primary_key=False,
                               unique=True,
                               nullable=True)
    enc_phone_number = db.Column(db.String(200),
                                 primary_key=False,
                                 nullable=True)
    deactivated = db.Column(db.Boolean, unique=False, default=False)
    auth_token = db.Column(UUIDType(binary=False),
                           primary_key=False,
                           nullable=True)
    package_id = db.Column(db.String(60), primary_key=False, nullable=True)

    def __repr__(self):
        return '<sid: %s, user_id: %s, os_type: %s, device_model: %s, push_token: %s, time_zone: %s, device_id: %s,' \
               ' onboarded: %s, public_address: %s, enc_phone_number: %s, package_id: %s, deactivated: %s'\
               % (self.sid, self.user_id, self.os_type, self.device_model, self.push_token, self.time_zone,
                  self.device_id, self.onboarded, self.public_address, self.enc_phone_number, self.package_id,
                  self.deactivated)
示例#6
0
class Picture(db.Model):
    """
    the represents a single picture
    """
    picture_id = db.Column(db.String(40), nullable=False, primary_key=True)
    picture_order_index = db.Column(db.Integer(), nullable=False, primary_key=False)
    title = db.Column(db.String(80), nullable=False, primary_key=False)
    image_url = db.Column(db.String(200), nullable=False, primary_key=False)
    author = db.Column(db.JSON)
    update_at = db.Column(db.DateTime(timezone=True), server_default=db.func.now(), onupdate=db.func.now())
    is_active = db.Column(db.Boolean, unique=False, default=True)

    def __repr__(self):
        return '<picture_id: %s, ' \
               'picture_order_index: %s,' \
               'title: %s,' \
               'author: %s, ' \
               'image_url: %s>' % (self.picture_id, self.picture_order_index, self.title, self.author, self.image_url)