class Group(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True) major = db.Column(db.Integer) teachers = db.relationship('Teachers_group', backref='group') subgroups = db.relationship('SubGroup', backref='group') schedule = db.relationship('Schedule', backref='group')
class Discipline(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) credit = db.Column(db.Integer) academic_hours = db.Column(db.Integer) groups = db.relationship('Group_discipline', backref='discipline') attendance = db.relationship('Attendance', backref='Discipline') schedule = db.relationship('Schedule', backref='Discipline')
class User(db.Model): id = db.Column(db.Integer, primary_key=True) public_id = db.Column(db.String, unique=True) name = db.Column(db.String(50), unique=True) password = db.Column(db.String(50)) admin = db.Column(db.Boolean) teacher = db.Column(db.Boolean) student = db.Column(db.Boolean) rteacher = db.relationship('Teacher', backref='user') rstudent = db.relationship('Student', backref='user')
class Student(db.Model): id = db.Column(db.Integer, primary_key=True) full_name = db.Column(db.String, unique=True) group_id = db.Column(db.Integer) status_id = db.Column(db.Integer) phone = db.Column(db.String) auth_num = db.Column(db.Integer, db.ForeignKey('user.id')) email = db.Column(db.String) attendance = db.relationship('Attendance', backref='student')
class Teacher(db.Model): id = db.Column(db.Integer, primary_key=True) full_name = db.Column(db.String(50), unique=True) auth_num = db.Column(db.Integer, db.ForeignKey('user.id')) groups = db.relationship('Teachers_group', backref='teacher') disciplines = db.relationship('Group_discipline', backref='teacher')
class ClassTime(db.Model): id = db.Column(db.Integer, primary_key=True) begining = db.Column(db.String) end = db.Column(db.String) disciplines = db.relationship('Schedule', backref='Time')
class DisciplineType(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) short = db.Column(db.String(10)) disciplines = db.relationship('Schedule', backref='DisciplineType')