class Chat(db.Model): id = db.Column(db.Integer, primary_key=True) sender_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True) recipient_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) body = db.Column(db.String(1000)) timestamp = db.Column(db.DateTime, index=True, default=datetime.now) #utc def __repr__(self): return "Chat('{self.body}','{self.timestamp}')"
class Jobcomment(db.Model): id = db.Column(db.Integer, primary_key=True) user_name = db.Column(db.String(1000), nullable=False) job_id = db.Column(db.Integer, db.ForeignKey('job.id'), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.now) message = db.Column(db.Text, nullable=False) def __repr__(self): return "Jobcomment('{self.message}', '{self.date_posted}')"
class Skill(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(200), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.now) content = db.Column(db.Text, nullable=False, default='None') user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return "Skill('{self.title}', '{self.date_posted}')"
class Job(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(1000), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.now) content = db.Column(db.Text, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) jobcomments = db.relationship('Jobcomment', backref='author', lazy=True) def __repr__(self): return "Job('{self.title}', '{self.date_posted}')"
from datetime import datetime from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from connect import db, login_manager, app from flask_login import UserMixin @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) followers = db.Table( 'followers', db.Column('follower_id', db.Integer, db.ForeignKey('user.id')), db.Column('followed_id', db.Integer, db.ForeignKey('user.id'))) class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(50), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) name = db.Column(db.String(50), unique=False, default='Not Given') rollno = db.Column(db.String(20), unique=False, default='Not Given') hall = db.Column(db.String(100), unique=False, default='None') department = db.Column(db.String(100), unique=False, default='None') support = db.Column(db.String(20), unique=False, default='Yes')