class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), 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) tickets = db.relationship('Ticket', backref='author', lazy=True) access = db.Column(db.String, default="user") def is_admin(): return self.access == "admin" def get_reset_token(self, expires_sec=1800): s = Serializer(app.config['SECRET_KEY'], expires_sec) return s.dumps({'user_id': self.id}).decode('utf-8') @staticmethod def verify_reset_token(token): s = Serializer(app.config['SECRET_KEY']) try: user_id = s.loads(token)['user_id'] except: return None return User.query.get(user_id) def __repr__(self): return f"User('{self.name}', '{self.email}', '{self.image_file}', '{self.access}')"
class Bugcomment(db.Model): id = db.Column(db.Integer, primary_key=True) bugid = db.Column(db.String(120), db.ForeignKey('project.id'), nullable=False) comment = db.Column(db.String(500), nullable=False) date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) def __repr__(self): return f"User('{self.id}', '{self.bugid}', '{self.comment}', '{self.date}')"
class Collaborator(db.Model): id = db.Column(db.Integer, primary_key=True) prid = db.Column(db.String(120), db.ForeignKey('project.id'), nullable=False) userid = db.Column(db.String(120), db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"User('{self.id}', '{self.prid}', '{self.userid}')"
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) image = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) comments = db.relationship('Comment', backref='author', lazy=True) worklogs = db.relationship('WorkLog', backref='author', lazy=True) tasks = db.relationship('Task', backref='assigned', lazy=True) def __repr__(self): return f'User({self.id} {self.username} {self.image} {self.password})'
class User(db.Model): AccessToken = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) FirstName = db.Column(db.String(20), nullable=False) LastName = db.Column(db.String(20), nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) notification = db.Column(db.Integer, default=0) posts = db.relationship('Post', lazy=True) def __repr__(self): return "User('{}', '{}','{}','{}','{}')".format( self.username, self.email, self.AccessToken, self.password, self.notification)
class Post(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) Description = db.Column(db.String(100), nullable=False) AssignedTo = db.Column(db.String(20), nullable=False) Createdby = db.Column(db.Integer, db.ForeignKey('user.AccessToken'), nullable=False) Status = db.Column(db.Boolean, default=True) def __repr__(self): return "Post('{}','{}', '{}','{}','{}','{}')".format( self.id, self.title, self.date_posted, self.Createdby, self.AssignedTo, self.date_posted)
class Project(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(120), unique=True, nullable=False) date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) status = db.Column(db.String(60), nullable=False) pitch = db.Column(db.String(500), nullable=False) bugs = db.relationship('Bug', backref='project', lazy=True) collaborators = db.relationship('Collaborator', backref='project', lazy=True) comments = db.relationship('Prcomment', backref='project', lazy=True) userid = db.Column(db.String(120), db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"User('{self.id}', '{self.name}', '{self.status}', '{self.date}', '{self.userid}')"
class Task(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) content = db.Column(db.Text, nullable=False) comments = db.relationship('Comment', backref='task', lazy=True) worklogs = db.relationship('WorkLog', backref='task', lazy=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) project_id = db.Column(db.Integer, db.ForeignKey('project.id')) type_id = db.Column(db.Integer, db.ForeignKey('task_type.id'), nullable=False) def __repr__(self): return f'{self.id} {self.title} {self.iser_id} {self.type_id}'
class Ticket(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) date_finished = db.Column(db.DateTime) content = db.Column(db.Text, nullable=False) state = db.Column( db.Text, nullable=False, default="pending") #pending, working on it, fixed, rejected severity = db.Column(db.Text, nullable=False) #minor, functional, critical user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"Ticket('{self.title}', '{self.date_posted}')"
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) firstname = db.Column(db.String(20), nullable=False) lastname = db.Column(db.String(20), nullable=False) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') def __repr__(self): return f"User('{self.id}', '{self.username}', '{self.email}', '{self.password}')"
class TaskType(db.Model): id = db.Column(db.Integer, primary_key=True) taskname = db.Column(db.String(20), nullable=False) def __repr__(self): return f'{self.id} {self.name}'
class Project(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), unique=True, nullable=False) description = db.Column(db.Text, nullable=False) tasks = db.relationship('Task', backref='project', lazy=True)