-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
75 lines (57 loc) · 2.74 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import ForeignKey, Integer, String, Boolean
from sqlalchemy.orm import relationship
db = SQLAlchemy()
class Student(db.Model, UserMixin):
student_number = db.Column(String(10), primary_key=True)
student_email = db.Column(String(255), nullable=False)
student_password = db.Column(String(255), nullable=False)
student_name = db.Column(String(255), nullable=False)
student_contact_no = db.Column(String(255), nullable=False)
student_program = db.Column(String(255), nullable=False)
student_year = db.Column(String(255), nullable=False)
student_concern = db.Column(String(255))
student_additional_comment = db.Column(String(255))
queue_order = db.Column(Integer)
queue_status = db.Column(String(255))
sms_sent = db.Column(Boolean, nullable=False, default=False)
role = db.Column(String(255), nullable=False, default="student")
queue_ID = db.Column(Integer, ForeignKey('queue.queue_ID'))
queue = relationship("Queue", backref="students")
def is_active(self):
return True
def get_id(self):
return self.student_number
def is_authenticated(self):
return True
class Admin(db.Model, UserMixin):
admin_id = db.Column(Integer, primary_key=True, autoincrement=True)
admin_number = db.Column(String(10))
admin_email = db.Column(String(255), nullable=False)
admin_password = db.Column(String(255), nullable=False)
admin_name = db.Column(String(255), nullable=False)
available = db.Column(Boolean, nullable=False, default=True)
zoom_link = db.Column(String(255))
status = db.Column(String(255))
role = db.Column(String(255), nullable=False, default="admin")
def is_active(self):
return True
def get_id(self):
return self.admin_number
def is_authenticated(self):
return True
class Queue(db.Model, UserMixin):
queue_ID = db.Column(db.Integer, primary_key=True, autoincrement=True)
admin_id = db.Column(db.Integer, db.ForeignKey('admin.admin_id'), nullable=False)
queue_status = db.Column(db.String(255), nullable=False)
admin = relationship("Admin", backref="queues")
class Feedback(db.Model, UserMixin):
feedback_id = db.Column(Integer, primary_key=True, autoincrement=True)
feedback = db.Column(String(255), nullable=False)
student_number = db.Column(String(10), ForeignKey('student.student_number'), nullable=False)
rating = db.Column(String(255), nullable=False)
admin_id = db.Column(Integer, ForeignKey('admin.admin_id'), nullable=False)
date = db.Column(String(255), nullable=False)
student = relationship("Student", backref="feedbacks")
admin = relationship("Admin", backref="feedbacks")