Host are now in their own class.
There are two kinds: endpoints and servers
class Host(db.Model):
"""
A class to model a host/machine
"""
__tablename__ = 'hosts'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100))
host_type = db.Column(db.String(50))
....
class Endpoint(Host):
"""
A class to model a endpoint
Endpoints are devices like laptops and desktop used by individual users
From simplification, we have a 1-1 relationship for User <-> Endpoint
"""
employee_id = db.Column(db.Integer, db.ForeignKey('employee.id'))
def __init__(self, name: str) -> None:
super().__init__(name, host_type="endpoint")
class Server(Host):
"""
A class to model a server
Servers are not directly associated with any one user
Servers can be of multiple types including
- Exchange, SSH, VPN, File, Web
"""
company_id = db.Column(db.Integer, db.ForeignKey('company.id'))
...
There is a 1-1 relationship between users and endpoints
There is a 1-many relationship between the company and servers
Employee hostnames are now derives from endpoints names
Host are now in their own class. There are two kinds: endpoints and servers
There is a 1-1 relationship between users and endpoints There is a 1-many relationship between the company and servers
Employee hostnames are now derives from endpoints names