class Role(db.Document): name = db.StringField(max_length=255, min_length=1, required=True, unique=True) description = db.StringField(max_length=255, default="") content = db.ListField( db.StringField(max_length=255, min_length=1, required=True))
class Score(db.Document): subject_code = db.IntField(required=True, min_length=1, unique=True) subject_name = db.StringField(required=True, min_length=1) tc = db.IntField(required=True, min_value=0) tk10 = db.FloatField(max_value=10, min_value=0, required=True) tkch = db.StringField(required=True, choices=RANK) tk4 = db.FloatField(max_value=4, min_value=0, required=True) hk = db.IntField(required=True, choices=(1, 2)) years = db.StringField(required=True, min_length=1) score_of = db.StringField(required=True)
class Employee(db.Document): employee_id = db.StringField(required=True, unique=True) employee_name = db.StringField(max_length=255, required=True) employee_gender = db.BooleanField(required=True) employee_birthday = db.DateTimeField(required=True) employee_avatar = db.StringField() def json(self): employee_dict = { "employee_id": self.employee_id, "employee_name": self.employee_name, "employee_gender": self.employee_gender, "employee_birthday": self.employee_birthday, "employee_avatar": self.employee_avatar, } return json.dumps(employee_dict) def get_id(self): return unicode(self.employee_id)
class Member(db.Document): member_id = db.StringField(required=True, unique=True) member_username = db.StringField(max_length=255, min_length = 1, required=True,unique=True) member_password = db.StringField(max_length=255, min_length = 6, required=True) member_first_name = db.StringField(max_length=255, min_length =1) member_last_name = db.StringField(max_length=255, min_length =1) member_gender = db.BooleanField(default=True) member_email = db.StringField(default="") member_address = db.StringField(max_length=255,default="") member_about_me = db.StringField(max_length=255,default="") member_avatar = db.StringField(default="") member_role = db.StringField(max_length=255, min_length =1,default="student") def checkPassword(self,password): if(self.member_password == password): return True else: return False
class BookingRoom(db.Document): booking_by = db.StringField(required=True, min_length=1) booking_student_code = db.IntField(required=True, min_value=1) booking_class_wildcard = db.StringField(required=True, min_length=1) booking_student_number = db.IntField(required=True, min_value=1) booking_purpose = db.StringField(required=True, min_length=1) booking_lecturer = db.StringField(required=True, min_length=1) booking_using_time = db.DateTimeField(required=True) booking_start_shift = db.IntField(required=True, choices=SHIFT) booking_end_shift = db.IntField(required=True) booking_note = db.StringField() booking_status = db.StringField(required=True, choices=STATUS, default="Pending") booking_room_name = db.StringField(required=True, min_length=1, default="None") booking_is_submit = db.IntField(required=True, default=0) booking_by_member = db.StringField(required=True) booking_by_member_role = db.StringField(required=True) booking_current_date = db.StringField(required=True)
class ObjectInfo(db.Document): object_name = db.StringField(required=True, unique=True) object_content = db.StringField(required=True)
class Message(db.Document): content = db.StringField() send_by = db.StringField() room_by = db.StringField()
class BookingRole(db.Document): booking_role = db.StringField() booking_role_limited = db.StringInt()