Пример #1
0
class Template(db.Model):

    __tablename__ = "template"
    templateID = db.Column(db.Integer,
                           primary_key=True,
                           autoincrement=True,
                           unique=True)
    templateName = db.Column(db.String(255))
    templateDescription = db.Column(db.String)
    templateCreateDate = db.Column(db.DateTime)
    templateCreatorID = db.Column(db.Integer)
    templateStatus = db.Column(db.String(255))
    templateRemoveDate = db.Column(db.DateTime)
    templateRemoveExecutorID = db.Column(db.Integer)
    templateDeleteDate = db.Column(db.DateTime)
    templateDeleteExecutorID = db.Column(db.Integer)
    templateDownloadURL = db.Column(db.String(255))
    templateCreatorRealName = db.Column(db.String(255))

    def __init__(self, templateName, templateDescription, templateCreateDate,
                 templateCreatorID, templateStatus, templateRemoveDate,
                 templateRemoveExecutorID, templateDeleteDate,
                 templateDeleteExecutorID, templateDownloadURL,
                 templateCreatorRealName):
        self.templateName = templateName
        self.templateDescription = templateDescription
        self.templateCreateDate = templateCreateDate
        self.templateCreatorID = templateCreatorID
        self.templateStatus = templateStatus
        self.templateRemoveDate = templateRemoveDate
        self.templateRemoveExecutorID = templateRemoveExecutorID
        self.templateDeleteDate = templateDeleteDate
        self.templateDeleteExecutorID = templateDeleteExecutorID
        self.templateDownloadURL = templateDownloadURL
        self.templateCreatorRealName = templateCreatorRealName
Пример #2
0
class Api(db.Model):
    __tablename__ = "apis"
    id = db.Column(db.Integer, primary_key=True)
    api_name = db.Column(db.String(100), unique=True, nullable=False)
    description = db.Column(db.String, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    user = relationship("User") # ägaren/parent
Пример #3
0
class File(db.Model):

    __tablename__ = "file"
    fileID = db.Column(db.Integer,
                       primary_key=True,
                       autoincrement=True,
                       unique=True)
    fileName = db.Column(db.String(255))
    fileDescription = db.Column(db.String)
    fileBelongedToTaskID = db.Column(db.Integer)
    fileBelongedToTaskName = db.Column(db.String)
    fileBelongedToProjectID = db.Column(db.Integer)
    fileBelongedToProjectName: db.Column(db.String)
    fileCreateDate = db.Column(db.DateTime)
    fileCreatorID = db.Column(db.Integer)
    fileCreatorName = db.Column(db.String)
    fileStatus = db.Column(db.String(255))
    fileRemoveDate = db.Column(db.DateTime)
    fileRemoveExecutorID = db.Column(db.Integer)
    fileDeleteDate = db.Column(db.DateTime)
    fileDeleteExecutorID = db.Column(db.Integer)
    fileDownloadURL = db.Column(db.String(255))

    def __init__(self, fileName, fileDescription, fileBelongedToTaskID,
                 fileBelongedToProjectID, fileCreateDate, fileCreatorID,
                 fileStatus, fileRemoveDate, fileRemoveExecutorID,
                 fileDeleteDate, fileDeleteExecutorID, fileDownloadURL,
                 fileBelongedToTaskName, fileBelongedToProjectName,
                 fileCreatorName):
        self.fileName = fileName
        self.fileDescription = fileDescription
        self.fileBelongedToTaskID = fileBelongedToTaskID
        self.fileBelongedToProjectID = fileBelongedToProjectID
        self.fileCreateDate = fileCreateDate
        self.fileCreatorID = fileCreatorID
        self.fileStatus = fileStatus
        self.fileRemoveDate = fileRemoveDate
        self.fileRemoveExecutorID = fileRemoveExecutorID
        self.fileDeleteDate = fileDeleteDate
        self.fileDeleteExecutorID = fileDeleteExecutorID
        self.fileDownloadURL = fileDownloadURL
        self.fileBelongedToTaskName = fileBelongedToTaskName
        self.fileBelongedToProjectName = fileBelongedToProjectName
        self.fileCreatorName = fileCreatorName
Пример #4
0
class RevokedToken(db.Model):
    __tablename__ = 'revoked_tokens'
    id = db.Column(db.Integer, primary_key=True)
    jti = db.Column(db.String(120))

    def add(self):
        db.session.add(self)
        db.session.commit()

    @classmethod
    def is_jti_blacklisted(cls, jti):
        query = cls.query.filter_by(jti=jti).first()
        return bool(query)
Пример #5
0
class sopFile(db.Model):

    __tablename__ = "sop"
    sop_id = db.Column(db.Integer,
                       primary_key=True,
                       autoincrement=True,
                       unique=True)
    sop_name = db.Column(db.String(255))
    study_id = db.Column(db.Integer)
    user_id = db.Column(db.Integer)
    sop_description = db.Column(db.String(255))
    sop_date_create = db.Column(db.DateTime)

    def __init__(self, sop_name, study_id, user_id, sop_description,
                 sop_date_create):
        self.sop_name = sop_name
        self.study_id = study_id
        self.user_id = user_id
        self.sop_description = sop_description
        self.sop_date_create = sop_date_create

    def __repr__(self):
        return '<Sop %r>' % self.sop_id
Пример #6
0
class Endpoint(db.Model):  # child till apis
    __tablename__ = "endpoints"
    id = db.Column(db.Integer, primary_key=True)
    uri = db.Column(db.String(100), nullable=False)
    api_id = db.Column(db.Integer, db.ForeignKey("apis.id"))
    apis = relationship("Api")  # api is parent to endpoint

    def to_dict(self):
        return {
            'id': self.id,
            'uri': self.uri,
            'api_id': self.api_id,
            'apis': self.apis
        }
Пример #7
0
class Study(db.Model):

    __tablename__ = "study"
    study_id = db.Column(db.Integer, primary_key=True, autoincrement = True, unique=True)
    name = db.Column(db.String(255))
    status_id = db.Column(db.Integer)
    user_id = db.Column(db.Integer)
    description  = db.Column(db.String(255))
    plan_start_date = db.Column(db.DateTime)
    plan_end_date = db.Column(db.DateTime)



    def __init__(self, name ,status_id, user_id, description, plan_start_date, plan_end_date):
        self.name = name
        self.status_id = status_id
        self.user_id = user_id
        self.description = description
        self.plan_start_date = plan_start_date
        self.plan_end_date = plan_end_date


    def __repr__(self):
        return '<Sop %r>' % self.sop_id
Пример #8
0
class Api(db.Model):
    __tablename__ = "apis"
    id = db.Column(db.Integer, primary_key=True)
    api_name = db.Column(db.String(100), unique=True, nullable=False)
    description = db.Column(db.String, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    user = relationship("User", cascade="save-update")  # ägaren/parent
    endpoints = relationship("Endpoint", cascade="all, delete-orphan")

    def to_dict(self):
        return {
            'id': self.id,
            'api_name': self.api_name,
            'description': self.description,
            'user_id': self.user_id,
            'endpoints': [endpoints.to_dict() for endpoints in self.endpoints]
        }
Пример #9
0
class Task(db.Model):

    __tablename__ = "task"
    taskID = db.Column(db.Integer, primary_key=True, autoincrement = True, unique=True)
    taskName =  db.Column(db.String(255))
    taskBelongedToProjectID =   db.Column(db.Integer)
    #belongedToTrialName = db.Column(db.String(255))
    taskCreatorID = db.Column(db.Integer)
    #taskCreatorName = db.Column(db.String(255))
    taskCreatedTime = db.Column(db.DateTime)
    taskExecutorID = db.Column(db.Integer)
    #taskExecutorName = db.Column(db.String(255))
    taskReceivedStatus = db.Column(db.String)
    taskDueTime = db.Column(db.DateTime)
    taskProgress = db.Column(db.Integer)
    taskCompletedStatus = db.Column(db.String)
    taskDescription = db.Column(db.String)
    taskActualCompletedTime = db.Column(db.DateTime)
    taskBelongedToProjectName = db.Column(db.String)
    taskExecutorRealName = db.Column(db.String)


    def __init__(self, taskName ,taskBelongedToProjectID,
                 taskCreatedTime, taskCreatorID, taskExecutorID,  taskReceivedStatus, taskDueTime,
                 taskProgress, taskCompletedStatus, taskDescription ,taskActualCompletedTime, taskBelongedToProjectName, taskExecutorRealName):
        self.taskName = taskName
        self.taskBelongedToProjectID = taskBelongedToProjectID
        #self.belongedToTrialName = belongedToTrialName
        self.taskCreatorID =taskCreatorID
        #self.taskCreatorName = taskCreatorName
        self.taskCreatedTime = taskCreatedTime
        self.taskExecutorID = taskExecutorID
        #self.taskExecutorName = taskExecutorName
        self.taskReceivedStatus = taskReceivedStatus
        self.taskDueTime = taskDueTime
        self.taskProgress = taskProgress
        self.taskCompletedStatus = taskCompletedStatus
        self.taskDescription = taskDescription
        self.taskActualCompletedTime = taskActualCompletedTime
        self.taskBelongedToProjectName = taskBelongedToProjectName
        self.taskExecutorRealName = taskExecutorRealName

    def __repr__(self):
        return '<Task %r>' % self. taskID
Пример #10
0
class User(db.Model):  # parent till apis
    __tablename__ = "users"
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(100), unique=True, nullable=False)
    password = db.Column(db.String, nullable=False)
    email = db.Column(db.String, nullable=False)
    apis = relationship("Api")

    def to_dict(self):
        return {
            'user_id': self.id,
            'username': self.username,
            'password': self.password,
            'email': self.email,
            "apis": [api.to_dict() for api in self.apis]
        }


#db.create_all()
#db.session.commit()