class ChucDanhTuPhapCanBo(db.Model): __tablename__ = 'ChucDanhTuPhapCanBo' __table_args__ = {"schema": "NhanSu"} id = db.Column(db.INTEGER, primary_key=True) can_bo_id = db.Column(db.INTEGER, db.ForeignKey('NhanSu.CanBo.id')) chuc_danh_tu_phap_id = db.Column(db.SMALLINT, db.ForeignKey('NhanSu.ChucDanhTuPhap.id')) ngay_bat_dau = db.Column(db.DATE()) ngay_ket_thuc = db.Column(db.DATE())
class Conference(db.Model): user_id = db.Column(db.Integer, db.ForeignKey("user.id")) id = db.Column(db.Integer, primary_key=True) start_date = db.Column(db.DATE()) end_date = db.Column(db.DATE()) title = db.Column(db.String(50)) event_type = db.Column(db.String(40)) role = db.Column(db.String(40)) location = db.Column(db.String(30)) primary_attribution = db.Column(db.String(40))
class NonAcademicCollabs(db.Model): user_id = db.Column(db.Integer, db.ForeignKey("user.id")) id = db.Column(db.Integer, primary_key=True) start_date = db.Column(db.DATE()) end_date = db.Column(db.DATE()) institution = db.Column(db.String(50)) department = db.Column(db.String(40)) location = db.Column(db.String(30)) collaborator = db.Column(db.String(40)) collaborator_goal = db.Column(db.String(50)) interaction_freq = db.Column(db.String(20)) primary_attribution = db.Column(db.String(40))
class DaoTaoDaiHan(db.Model): __tablename__ = 'DaoTaoDaiHan' __table_args__ = {"schema": "NhanSu"} id = db.Column(db.SMALLINT, primary_key=True) can_bo_id = db.Column(db.INTEGER, db.ForeignKey('NhanSu.CanBo.id')) co_so_dao_tao_id = db.Column(db.SMALLINT, db.ForeignKey('NhanSu.CoSoDaoTao.id')) trinh_do_nghiep_vu_id = db.Column( db.SMALLINT, db.ForeignKey('NhanSu.TrinhDoNghiepVu.id')) ngay_bat_dau = db.Column(db.DATE()) ngay_ket_thuc = db.Column(db.DATE()) ket_qua = db.Column(db.NVARCHAR(50)) ghi_chu = db.Column(db.NVARCHAR)
class ViTri(db.Model): __tablename__ = 'ViTri' __table_args__ = {"schema": "NhanSu"} id = db.Column(db.INTEGER, primary_key=True) can_bo_id = db.Column(db.INTEGER, db.ForeignKey('NhanSu.CanBo.id'), nullable=False) bo_phan_id = db.Column(db.SMALLINT, db.ForeignKey('NhanSu.BoPhan.id'), nullable=False) cong_viec = db.Column(db.NVARCHAR(255)) nhom_vi_tri_id = db.Column(db.SMALLINT, db.ForeignKey('NhanSu.NhomViTri.id')) ngay_bat_dau = db.Column(db.DATE()) ngay_ket_thuc = db.Column(db.DATE())
class HeSoLuongCanBo(db.Model): __tablename__ = 'HeSoLuongCanBo' __table_args__ = {"schema": "NhanSu"} id = db.Column(db.INTEGER, primary_key=True) can_bo_id = db.Column(db.INTEGER, db.ForeignKey('NhanSu.CanBo.id')) he_so = db.Column(db.DECIMAL(4, 2)) ngay_bat_dau = db.Column(db.DATE())
class CapBacCanBo(db.Model): __tablename__ = 'CapBacCanBo' __table_args__ = {"schema": "NhanSu"} id = db.Column(db.INTEGER, primary_key=True) can_bo_id = db.Column(db.INTEGER, db.ForeignKey('NhanSu.CanBo.id')) cap_bac_id = db.Column(db.SMALLINT, db.ForeignKey('NhanSu.CapBac.id')) ngay_bat_dau = db.Column(db.DATE())
class Users(UserMixin, db.Model): """This table represents the user""" __tablename__ = "Users" fname = db.Column(db.VARCHAR(100)) lname = db.Column(db.VARCHAR(100)) username = db.Column(db.VARCHAR(100)) password = db.Column(db.VARCHAR(100)) address = db.Column(db.VARCHAR(100)) email = db.Column(db.VARCHAR(100)) birthdate = db.Column(db.DATE()) userID = db.Column(db.Integer, primary_key=True) # @property # def password(self): # """ # Prevent pasword from being accessed # """ # raise AttributeError('password is not a readable attribute.') # # @password.setter # def password(self, password): # """ # Set password to a hashed password # """ # self.password = password # def get_id(self): """Needed to overirde feature of parent class""" return self.userID def verify_password(self, password): """ Check if hashed password matches actual password """ return True # Will figure out later check_password_hash(self.password_hash, password) def __repr__(self): "[" \ "fname: {fname}," \ "lname: {lname}," \ "username: {username}," \ "email: {email}," \ "password: {password}," \ "address: {address}," \ "birthdate: {birthdate}," \ "userID: {userID}," \ "]".format(fname=self.fname, lname=self.lname, username=self.username, email=self.email, password=self.password, address=self.address, userID=self.userID)