class Category(db.Model): id = db.Column(db.Integer, primary_key=True) categorys = db.Column(db.String(500)) blogs = db.relationship('Blog', backref="category", uselist=False) def __init__(self, categorys): self.categorys = categorys
class Tag(db.Model): id = db.Column(db.Integer, primary_key=True) tags = db.Column(db.String(500)) blogTag = db.relationship('Blog', backref="tag", uselist=False) def _init_(self, tags): self.tags = tags
class Subscribe(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(200), unique=True) name = db.Column(db.String(200)) date = db.Column(db.String(200)) topics = db.Column(db.Text()) def __init__(self, email, name, topics, date): self.topics = topics self.email = email self.date = date self.name = name
class Auth(db.Model): id = db.Column(db.Integer, primary_key = True) uid = db.Column(db.Integer, unique = True) password = db.Column(db.String(200)) isVerified = db.Column(db.Integer) email = db.Column(db.String(100)) userInfo = db.relationship('User', backref="auth", uselist=False) def __init__(self, uid, password, email, isVerified): self.uid = uid self.password = password self.email = email self.isVerified = isVerified
class User(db.Model): id = db.Column(db.Integer, primary_key = True) auth_id = db.Column(db.Integer, db.ForeignKey('auth.id'), unique = True) username = db.Column(db.String(50)) fullname = db.Column(db.String(50)) email = db.Column(db.String(100)) phone = db.Column(db.String(20)) sex = db.Column(db.String(7)) image = db.Column(db.String(500)) date_added = db.Column(db.String(50)) def __init__(self, username, fullname, email, sex, auth_id, image, date_added): self.username = username self.firstname = firstname self.lastname = lastname self.email = email self.sex = sex self.auth_id = auth_id self.date_added = date_added
class ChatModel(db.Model): id = db.Column(db.Integer, primary_key=True) channel_id = db.Column(db.BigInteger, unique=True) channel_name = db.Column(db.String(50)) uid = db.Column(db.String(50)) users = db.Column(db.Text()) date_added = db.Column(db.String(50)) chat_history = db.relationship('MessagesModel', backref="chat_model", uselist=False)
class Blog(db.Model): id = db.Column(db.Integer, primary_key=True) category_id = db.Column(db.Integer, db.ForeignKey('category.id'), unique=True) tag_id = db.Column(db.Integer, db.ForeignKey('tag.id'), unique=True) title = db.Column(db.String(500)) content = db.Column(db.String(900)) author = db.Column(db.String(100)) image = db.Column(db.String(500)) date = db.Column(db.String(50)) def __init__(self, title, content, author, category_id, tag_id, image, date): self.title = title self.content = content self.author = author self.category_id = category_id self.tag_id = tag_id self.image = image self.date = date
class MessagesModel(db.Model): id = db.Column(db.Integer, primary_key=True) channel_id = db.Column(db.BigInteger, db.ForeignKey('chat_model.channel_id'), unique=True) messages = db.Column(db.Text())