Ejemplo n.º 1
0
class User(db.Model, UserMixin):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), unique=True, nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
    image_file = db.Column(db.String(20), default="default.jpg")
    password = db.Column(db.String(60), nullable=False)
    ### Links to Progam db model
    creator_program = db.relationship("Program", backref="creator_program", lazy=True)
    creator_project = db.relationship("Project", backref="creator_project", lazy=True)

    def __repr__(self):
        return f"User|'{self.id}','{self.username}','{self.email}','{self.image_file}','{self.password}','{self.create_program}'"
Ejemplo n.º 2
0
class Part(db.Model):
    __tablename__ = "part"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    description = db.Column(db.Text, unique=False, nullable=False)
    created_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    created_by = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
Ejemplo n.º 3
0
class RuntimeConfig(db.Model):
    __tablename__ = "runtime_config"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    description = db.Column(db.Text, unique=False, nullable=False)
    created_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=False)
Ejemplo n.º 4
0
class Model(db.Model):
    __tablename__ = "model"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    description = db.Column(db.Text, unique=False, nullable=False)
    created_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    created_by = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
    program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=False)

    def __repr__(self):
        return f"Model|'{self.name}'),'{self.description}','{self.created_date}'"
Ejemplo n.º 5
0
class Program(db.Model):
    __tablename__ = "program"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    description = db.Column(db.Text, unique=False, nullable=False)
    created_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    created_by = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)

    ### Relationship
    project = db.relationship("Project", back_populates="program")  # forward

    def __repr__(self):
        return f"Program|'{self.name}'),'{self.description}','{self.created_date}', '{self.created_by}'"
Ejemplo n.º 6
0
class Case(db.Model):
    __tablename__ = "case"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=False, nullable=False)
    description = db.Column(db.Text, unique=False, nullable=False)
    created_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    created_by = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
    project_id = db.Column(db.Integer, db.ForeignKey("project.id"), nullable=False)
    model_id = db.Column(db.Integer, db.ForeignKey("model.id"), nullable=False)
    baseline_id = db.Column(db.Integer, ForeignKey("model.id"))
    ridemap_id = db.Column(db.Integer, db.ForeignKey("ridemap.id"), nullable=False)

    project = db.relationship("Project", back_populates="case")

    geometry_id = db.Column(db.Integer, ForeignKey("geomconfig.id"))
    

    def __repr__(self):
        return f"Case|('{self.id}','{self.name}'),'{self.description}','{self.project_id}','{self.model_id}'"