Exemple #1
0
class Address(db.Model):
    """Addresses table"""
    id: int
    name: str

    __tablename__ = 'Address'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False, unique=True)
    address = db.relationship('Employee', backref='Address', lazy='dynamic')

    def __init__(self, name):
        self.name = name
Exemple #2
0
class Skill(db.Model):
    """Skills table"""
    id: int
    name: str

    __tablename__ = 'Skill'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False, unique=True)
    skill = db.relationship('Employee', backref='Skill', lazy='dynamic')

    def __init__(self, name):
        self.name = name
Exemple #3
0
class Permission(db.Model):
    """Permissions table"""
    __tablename__ = 'Permission'
    id: int
    name: str

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False, unique=True)
    permission = db.relationship('Employee',
                                 backref='Permission',
                                 lazy='dynamic')

    def __init__(self, name):
        self.name = name
Exemple #4
0
class Location(db.Model):
    """Locations table"""
    id: int
    name: str

    __tablename__ = 'Location'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False, unique=True)
    location = db.relationship('Employee', backref='Location', lazy='dynamic')

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return '<Location: {}>'.format(self.name)
Exemple #5
0
class Department(db.Model):
    """Departments table"""
    id: int
    name: str
    manager: str
    date_of_creation: str

    __tablename__ = 'Department'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False, unique=True)
    manager = db.Column(db.String(100), nullable=False)
    date_of_creation = db.Column(db.String(50), default=datetime.date.today())
    department = db.relationship('Employee',
                                 backref='Department',
                                 lazy='dynamic')

    def __init__(self, name, manager, date_of_creation):
        self.name = name
        self.manager = manager
        self.date_of_creation = date_of_creation