39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
from ..dependencies import db
|
|
from ..base.models import Base
|
|
|
|
|
|
class ExaminationSchedule(Base):
|
|
__tablename__ = 'examination_schedules'
|
|
|
|
title = db.Column(db.String(100), unique=True, nullable=False)
|
|
mode = db.Column(db.Boolean, default=True, nullable=False) # True - stationary, False - non-stationary
|
|
start_date = db.Column(db.DateTime)
|
|
end_date = db.Column(db.DateTime)
|
|
|
|
|
|
class Enrollment(Base):
|
|
__tablename__ = 'enrollments'
|
|
|
|
start_date = db.Column(db.DateTime, nullable=False)
|
|
end_date = db.Column(db.DateTime, nullable=False)
|
|
examination_schedule_id = db.Column(db.Integer, db.ForeignKey('examination_schedules.id'))
|
|
examination_schedule = db.relationship('ExaminationSchedule', backref='enrollments')
|
|
committee = db.relationship("Committee", uselist=False, backref=db.backref('enrollment', passive_deletes=True))
|
|
group_id = db.Column(db.Integer, db.ForeignKey('groups.id'))
|
|
group = db.relationship("Group", uselist=False, backref='enrollment')
|
|
|
|
|
|
class Committee(Base):
|
|
__tablename__ = 'committees'
|
|
|
|
enrollment_id = db.Column(db.Integer, db.ForeignKey('enrollments.id', ondelete='CASCADE'))
|
|
members = db.relationship('ProjectSupervisor', secondary='committees_projects_supervisors', backref='committees')
|
|
|
|
|
|
class CommitteeProjectSupervisor(Base):
|
|
__tablename__ = 'committees_projects_supervisors'
|
|
|
|
chairman = db.Column(db.Boolean, default=False, nullable=False)
|
|
committee_id = db.Column(db.Integer, db.ForeignKey('committees.id'))
|
|
member_id = db.Column(db.Integer, db.ForeignKey('project_supervisors.id'))
|