class Application(sa_db.Model): __tablename__ = 'TB_APPLICATION' id = sa_db.Column(sa_db.Integer, primary_key=True) username = sa_db.Column(sa_db.String(32), nullable=False) destination = sa_db.Column(sa_db.String(32), nullable=False) contact = sa_db.Column(sa_db.String(32), nullable=False) work_flow_id = sa_db.Column(sa_db.Integer, sa_db.ForeignKey('TB_WORK_FLOW.id')) work_flow = sa_db.relationship('WorkFlow')
class User(UserMixin, sa_db.Model): __tablename__ = 'TB_USER' id = sa_db.Column(sa_db.Integer, primary_key=True) username = sa_db.Column(sa_db.String(32), nullable=False, unique=True) group_id = sa_db.Column(sa_db.Integer, sa_db.ForeignKey('TB_GROUP.id')) group = sa_db.relationship("Group") @property def is_clerk(self): return self.group.name == 'Clerks'
class Group(sa_db.Model): __tablename__ = 'TB_GROUP' id = sa_db.Column(sa_db.Integer, primary_key=True) name = sa_db.Column(sa_db.String(32), nullable=False, unique=True)