class Project(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(50), unique=True, nullable=False) code = db.Column(db.String(50), nullable=True) desc = db.Column(db.Text, nullable=False) status = db.Column(db.Integer, nullable=True, default=0) guide_id = db.Column(db.Integer, db.ForeignKey('guide.id'), nullable=True) external_id = db.Column(db.Integer, db.ForeignKey('guide.id'), nullable=True) team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=True) techUsed = db.Column(db.Text, nullable=True) date_created = db.Column(db.DateTime, nullable=False, default=datetime.now() + timedelta(hours=5, minutes=30)) ext_relation = db.relationship('Guide', foreign_keys=[external_id], backref='external') int_relation = db.relationship('Guide', foreign_keys=[guide_id], backref='mentor') # projectDemo = db.relationship('ProjectGuideDemo', backref="projectDemoDetails", lazy=True) def __repr__(self): return f"Project('{self.title}', '{self.status}', '{self.guide_id}', '{self.date_created}' )"
class ProjectGuideDemo(db.Model): id = db.Column(db.Integer, primary_key=True) project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True) guide_id = db.Column(db.Integer, db.ForeignKey('guide.id'), nullable=True) demo_id = db.Column(db.Integer, db.ForeignKey('demo.id'), nullable=True) project = db.relationship('Project', backref="demoDetails", lazy=True) guide = db.relationship('Guide', backref="demoDetails", lazy=True) demo = db.relationship('Demo', backref="demoDetails", lazy=True)
class Project(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(50), unique=True, nullable=False) code = db.Column(db.String(50), nullable=True) desc = db.Column(db.Text, nullable=False) status = db.Column(db.String(20), nullable=True, default='NotPublished') guide_id = db.Column(db.Integer, db.ForeignKey('guide.id'), nullable=True) team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=True) techUsed = db.Column(db.Text, nullable=True) reason = db.Column(db.Text, nullable=False) date_created = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) def __repr__(self): return f"Project('{self.title}', '{self.leader}', '{self.status}', '{self.guide_id}', '{self.date_created}')"
class Demo(db.Model): id = db.Column(db.Integer, primary_key=True) demo_date = db.Column(db.DateTime, nullable=False, default=datetime.now() + timedelta(hours=5, minutes=30)) remark = db.Column(db.Text, nullable=True) marks_id = db.Column(db.Integer, db.ForeignKey('marks.id'), nullable=True) progress = db.Column(db.Integer, nullable=False)
class Student(db.Model): id = db.Column(db.Integer, primary_key=True) team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=True) name = db.Column(db.String(50), nullable=False) email = db.Column(db.String(120), nullable=False) phone = db.Column(db.String(10), nullable=False) cls = db.Column(db.String(7), nullable=False) def __repr__(self): return f"Student('{self.name}', '{self.email}', '{self.phone}', '{self.cls}')"
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) content = db.Column(db.Text, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"Post('{self.title}', '{self.date_posted}')"
class Visit(db.Model): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) bookerId = db.Column(db.Integer, db.ForeignKey('user.id')) doctorId = db.Column(db.Integer, nullable=False) date = db.Column(db.String(20), nullable=False) startTime = db.Column(db.String(20), nullable=False) diganosis = db.Column(db.String(600), nullable=False, default = 'Brak diagnozy') recommendations = db.Column(db.String(600), nullable=False, default = 'Brak zaleceń') def __repr__(self): return f"Visit('{self.id}', '{self.date}', '{self.startTime}')"
class Abstract(db.Model): id = db.Column(db.Integer, primary_key=True) project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True) abs_desc = db.Column(db.Text, nullable=False) status = db.Column(db.Integer, nullable=False, default=0) acceptance_date = db.Column(db.DateTime, nullable=False, default=datetime.now() + timedelta(hours=5, minutes=30)) project = db.relationship('Project', backref='abstract', lazy=True)
class Stage(db.Model): id = db.Column(db.Integer, primary_key=True) project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True) completed_stage = db.Column(db.Integer, nullable=False, default=0) started_time = db.Column(db.DateTime, default=datetime.now() + timedelta(hours=5, minutes=30)) completion_time = db.Column(db.DateTime, nullable=False, default=datetime.now() + timedelta(hours=5, minutes=30)) project = db.relationship('Project', backref='stage', lazy=True)