Esempio n. 1
0
class LikeDB(db.Model):
    __tablename__ = 'likes'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    username = db.Column(db.String(24), db.ForeignKey('users.username'), nullable=False)
    postorcomment = db.Column(db.Integer, nullable=False) 
    comment_id = db.Column(db.Integer, db.ForeignKey('comments.id'), nullable=False)
    post_id = db.Column(db.Integer, db.ForeignKey('posts.id'), nullable=False)
    type_like = db.Column(db.String(1), nullable=False)
Esempio n. 2
0
class CommentDB(db.Model):
    __tablename__ = 'comments'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    content = db.Column(db.String(1000), nullable=False)
    author = db.Column(db.String(24), db.ForeignKey('users.username'), nullable=False)
    post_id = db.Column(db.Integer, db.ForeignKey('posts.id'), nullable=False)
    num_likes = db.Column(db.Integer, nullable=False)
    time = db.Column(db.DateTime, nullable=False)
Esempio n. 3
0
class UserTagDB(db.Model):
    __tablename__ = 'users_tags'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    tag_id = db.Column(db.Integer, db.ForeignKey('tags.id'), nullable=False)
    username = db.Column(db.String(24), db.ForeignKey('users.username'), nullable=False)
    weight = db.Column(db.Integer, nullable=False)
Esempio n. 4
0
class TagDB(db.Model):
    __tablename__ = 'tags'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    name = db.Column(db.String(30), nullable=False)
Esempio n. 5
0
class UserDB(UserMixin, db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True, nullable=False)
    email = db.Column(db.String(48),unique=True, nullable=False)
    username = db.Column(db.String(24), unique=True, nullable=False)
    pass_hash = db.Column(db.String(128), nullable=False)