class Project(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(60), nullable=False) date_posted = db.Column(db.DateTime) upload_file = db.Column(db.String(20), nullable=False) description = db.Column(db.Text(1500), nullable=False) optional_link = db.Column(db.String) creators_num = db.Column(db.Integer, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) last_editor = db.Column(db.String) score_points_pool = db.Column(db.Integer, default=0) score_points_pool_shuffled = db.Column(db.Integer, default=0) score_pool_per_project = db.Column(db.Integer, default=0) score_admin = db.Column(db.Integer, default=0) score_admin_improvement = db.Column(db.Integer, default=0) user_distinctions = db.Column(db.Integer, default=0) admin_distinction = db.Column(db.Boolean, default=False) comments = db.relationship('Comments', backref='project', lazy=True, cascade="all, delete") date_posted_improvement = db.Column(db.DateTime) title_improvement = db.Column(db.String(60)) upload_file_improvement = db.Column(db.String(20)) description_improvement = db.Column(db.Text(1500)) optional_link_improvement = db.Column(db.String) def __repr__(self): return f"Project('{self.title}', 'author_id={self.user_id}')"
class Comments(db.Model): id = db.Column(db.Integer, primary_key=True) comment_star_1 = db.Column(db.Text(1000), nullable=False) comment_star_2 = db.Column(db.Text(1000), nullable=False) comment_wish = db.Column(db.Text(1000), nullable=False) second_iteration = db.Column(db.Boolean, default=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text(), nullable=False) email = db.Column(db.Text(), nullable=False) password = db.Column(db.Text(), nullable=False) def __repr__(self): return '{}'.format(self.name)
class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(100), unique=True) image = db.Column(db.Text(), default='index.png') password = db.Column(db.String(100)) name = db.Column(db.String(1000)) posts = db.relationship('Post', backref='user', lazy=True)
class User(db.Model, UserMixin): _id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(120), unique=True, nullable=False) name = db.Column(db.String(120), unique=False, nullable=True) email = db.Column(db.String(120), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default="default.png") password = db.Column(db.String(60), nullable=False) location = db.Column(db.String(120), nullable=True) bio = db.Column(db.Text(), nullable=True) posts = db.relationship("Post", backref="author", lazy=True) def __repr__(self): return f"User ('{self.username}, {self.email} , {self.image_file}')" def get_id(self): return self._id