class NetworkBaselineView(db.Model): """Network Baseline view model""" __tablename__ = 'vw_baseline' __table_args__ = {'schema': 'live_network'} vendor = db.Column(db.String(50)) technology = db.Column(db.String(50)) mo = db.Column(db.String(200), primary_key=True) parameter = db.Column(db.String(200), primary_key=True) value = db.Column(db.String(200)) date_added = db.Column(db.String(50)) date_modified = db.Column(db.String(50))
class NetworkBaseline(db.Model): """Network Base line model""" __tablename__ = 'base_live_values' __table_args__ = {'schema': 'live_network'} pk = db.Column(db.Integer, db.Sequence('seq_base_live_values_pk', ), primary_key=True, nullable=False) parameter_pk = db.Column(db.Integer, nullable=False) value = db.Column(db.String(200)) modified_by = db.Column(db.Integer) added_by = db.Column(db.Integer) date_added = db.Column(db.TIMESTAMP, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow) date_modified = db.Column(db.TIMESTAMP, default=datetime.datetime.utcnow)
class Technology(db.Model): """Technology model""" __tablename__ = 'technologies' pk = db.Column(db.Integer, db.Sequence('seq_technologies_pk', ), primary_key=True, nullable=False) name = db.Column(db.String(255), unique=True, nullable=False) notes = db.Column(db.Text) modified_by = db.Column(db.Integer) added_by = db.Column(db.Integer) date_added = db.Column(db.TIMESTAMP, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow) date_modified = db.Column(db.TIMESTAMP, default=datetime.datetime.utcnow) def __init__(self, name, notes, modified_by, added_by): self.name = name self.notes = notes self.modified_by = modified_by self.added_by = added_by
class User(db.Model): """Users model""" __tablename__ = 'users' pk = db.Column(db.Integer, db.Sequence('seq_users_pk', ), primary_key=True, nullable=False) username = db.Column(db.String(255), unique=True, nullable=False) password = db.Column(db.String(255), nullable=False) first_name = db.Column(db.String(255), nullable=False) last_name = db.Column(db.String(255)) other_names = db.Column(db.String(255)) job_title = db.Column(db.String(255)) phone_number = db.Column(db.String(255)) photo = db.Column(db.Text) token = db.Column(db.String(255)) is_account_non_expired = db.Column(db.Boolean, default=True) is_account_non_locked = db.Column(db.Boolean, default=True) is_enabled = db.Column(db.Boolean, default=True) def __init__(self, username, password, first_name, last_name, other_names, phone_number, photo, job_title, token, is_account_non_expired, is_account_non_locked, is_enabled): self.username = username self.password = password self.first_name = first_name self.last_name = last_name self.other_names = other_names self.phone_number = phone_number self.photo = photo self.job_title = job_title self.token = token self.is_account_non_expired = is_account_non_expired self.is_account_non_locked = is_account_non_locked self.is_enabled = is_enabled def is_authenticated(self): return True def is_active(self): return True def is_anonymous(self): return False def get_id(self): return str(self.email)