class Task(db.Model): """checks user and category, gets category color. creates task and milestone""" task_id = db.Column(db.Integer, primary_key=True, autoincrement=True) task_name = db.Column(db.String(100), nullable=False) task_start_date = db.Column(db.String(100), nullable=False) task_end_date = db.Column(db.String(100), nullable=False) task_milestone_name = db.Column(db.String(100), nullable = True) task_milestone_date = db.Column(db.String(100), nullable = True) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) user = db.relationship('User', backref='tasks') category_id = db.Column(db.Integer, db.ForeignKey('category.category_id')) category = db.relationship('Category', backref="tasks") def __repr__(self): return f"Task('{self.task_id}', '{self.task_name}', '{self.task_start_date}', '{self.task_end_date}', '{self.category_id}', '{self.task_milestone_name}', '{self.task_milestone_date}')"
class Milestone(db.Model): # delete this milestone_id = db.Column(db.Integer, primary_key=True, autoincrement=True) milestone_name = db.Column(db.String(100), nullable=False) task_id = db.Column(db.Integer, db.ForeignKey('task.task_id'), nullable=True) def __repr__(self): return f"Milestone('{self.milestone_id}', '{self.milestone_name}', '{self.milestone_date}', '{self.task_id}')"
class Category(db.Model): category_id = db.Column(db.Integer, primary_key=True, autoincrement=True) category_name = db.Column(db.String(100), nullable=False) category_color = db.Column(db.String(100), nullable=False) category_checked = db.Column(db.Boolean, nullable=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) user = db.relationship('User', backref="categories") def __repr__(self): return f"Category('{self.category_name}', '{self.category_color}')"