예제 #1
0
파일: Team.py 프로젝트: Puwong/MiMac
class Team(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(64))
    desc = db.Column(db.String(256))
    owner_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    users = db.relationship("TeamUserRelationship",
                            backref="team",
                            lazy='dynamic')
예제 #2
0
class Article(db.Model):
    # 设计成可以分段加载的,一次性把所有的text_node加载进来按时间排序
    # 题目限制 60 个汉字,120 个字符
    # 一段文章的限制为 10000 个汉字
    id = db.Column(db.Integer, primary_key=True)
    owner_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    title = db.Column(db.String(128))
    text_nodes = db.relationship("TextNode", backref="article", lazy='dynamic')
    delete = db.Column(db.Boolean, default=False)
    visitor_count = db.Column(db.Integer, default=0)
    created_at = db.Column(db.Integer, default=time.time)
    modified_at = db.Column(db.Integer, default=time.time, onupdate=time.time)
예제 #3
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    type = db.Column(
        db.SmallInteger,
        default=MessageType.NORMAL)  # normal, yes_or_no, must_reply
    reply_message_id = db.Column(db.Integer,
                                 default=0)  # None if no one to reply
    from_user_id = db.Column(db.Integer, nullable=False)
    message_batch_id = db.Column(db.Integer, db.ForeignKey('message_batch.id'))

    context = db.Column(db.String(2048), default='')
    readed = db.Column(db.Boolean, default=False)
    created_at = db.Column(db.Integer, default=time.time)
예제 #4
0
파일: Image.py 프로젝트: Puwong/MiMac
class Image(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(128))
    uri = db.Column(db.String(128))
    state = db.Column(db.SmallInteger, default=ImageState.WAIT_LABEL)
    freeze = db.Column(db.Boolean, default=False)
    delete = db.Column(db.Boolean, default=False)
    users = db.relationship("ImageUserRelationship",
                            backref="image",
                            lazy='dynamic')
    alg_id = db.Column(db.Integer, db.ForeignKey('alg.id'))

    @property
    def store_uri(self):
        return self.uri + '.raw'
예제 #5
0
class AlgUserRelationship(db.Model):
    #  因为设计上有些东西没有想明白,比如如果某一个管理员删除了一个算法后
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    alg_id = db.Column(db.Integer, db.ForeignKey('alg.id'))
예제 #6
0
class ImageUserRelationship(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    image_id = db.Column(db.Integer, db.ForeignKey('image.id'))
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    isOwner = db.Column(db.Boolean, nullable=False, default=False)
예제 #7
0
class TeamUserRelationship(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    team_id = db.Column(db.Integer, db.ForeignKey('team.id'))
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    isLeader = db.Column(db.Boolean, nullable=False, default=False)
예제 #8
0
class TextNode(db.Model):
    # 一段文章的限制为 10000 个汉字
    id = db.Column(db.Integer, primary_key=True)
    context = db.Column(db.String(2048))
    created_at = db.Column(db.Integer, default=time.time)
    article_id = db.Column(db.Integer, db.ForeignKey('article.id'))