""" file containing all classes/functions to handle Path from the database """ from flask import url_for from shared import PA, ICON from main import db ################################################################################ class PathType(db.Model): """Class describing the type of Paths in the database Attributes: id (int): database id of row in PathType table / primary key name (str): name of path type (e.g. import, storage, bin) """ __tablename__ = "path_type" id:int = db.Column(db.Integer, db.Sequence("path_type_id_seq"), primary_key=True ) name:str = db.Column(db.String, unique=True, nullable=False ) def __repr__(self): return f"" ################################################################################ class Path(db.Model): __allow_unmapped__ = True """Class describing a Path in the database Attributes: id (int): database id of row in Path table / primary key type_id (int): id of row in PathType table / foreign key type (PathType): sqlalchemy relationship of PathType using type_id path_prefix (str): The actual dir on the filesystem that defines this Path num_files (int): number of files in this Path """ __tablename__ = "path" id:int = db.Column(db.Integer, db.Sequence("path_id_seq"), primary_key=True ) type_id:int = db.Column(db.Integer, db.ForeignKey("path_type.id")) type:PathType = db.relationship("PathType") path_prefix:str = db.Column(db.String, unique=True, nullable=False ) num_files:int = db.Column(db.Integer) def __repr__(self): return f""