2019-12-18 19:02:17 +00:00
|
|
|
import enum
|
|
|
|
|
2019-12-31 21:32:47 +00:00
|
|
|
from marshmallow_sqlalchemy import ModelSchema
|
2019-12-18 19:02:17 +00:00
|
|
|
|
2020-03-05 16:18:20 +00:00
|
|
|
from crc import db
|
2019-12-18 19:02:17 +00:00
|
|
|
|
2020-03-13 18:56:46 +00:00
|
|
|
class WorkflowSpecCategoryModel(db.Model):
|
|
|
|
__tablename__ = 'workflow_spec_category'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
name = db.Column(db.String)
|
|
|
|
display_name = db.Column(db.String)
|
|
|
|
|
|
|
|
|
|
|
|
class WorkflowSpecCategoryModelSchema(ModelSchema):
|
|
|
|
class Meta:
|
|
|
|
model = WorkflowSpecCategoryModel
|
|
|
|
|
2019-12-18 19:02:17 +00:00
|
|
|
|
|
|
|
class WorkflowSpecModel(db.Model):
|
|
|
|
__tablename__ = 'workflow_spec'
|
|
|
|
id = db.Column(db.String, primary_key=True)
|
2020-01-21 20:22:44 +00:00
|
|
|
name = db.Column(db.String)
|
2019-12-18 19:02:17 +00:00
|
|
|
display_name = db.Column(db.String)
|
|
|
|
description = db.Column(db.Text)
|
2020-01-23 15:54:41 +00:00
|
|
|
primary_process_id = db.Column(db.String)
|
2020-03-16 16:10:32 +00:00
|
|
|
workflow_spec_category_id = db.Column(db.Integer, db.ForeignKey('workflow_spec_category.id'), nullable=True)
|
2020-03-13 18:56:46 +00:00
|
|
|
workflow_spec_category = db.relationship("WorkflowSpecCategoryModel")
|
2020-03-15 19:52:59 +00:00
|
|
|
is_status = db.Column(db.Boolean, default=False)
|
2019-12-18 19:02:17 +00:00
|
|
|
|
2020-02-18 15:14:03 +00:00
|
|
|
|
2020-01-03 16:44:24 +00:00
|
|
|
class WorkflowSpecModelSchema(ModelSchema):
|
2019-12-18 19:02:17 +00:00
|
|
|
class Meta:
|
|
|
|
model = WorkflowSpecModel
|
2020-03-13 18:56:46 +00:00
|
|
|
include_fk = True # Includes foreign keys
|
2019-12-18 19:02:17 +00:00
|
|
|
|
2020-01-03 16:44:24 +00:00
|
|
|
|
2019-12-18 19:02:17 +00:00
|
|
|
class WorkflowStatus(enum.Enum):
|
|
|
|
new = "new"
|
|
|
|
user_input_required = "user_input_required"
|
|
|
|
waiting = "waiting"
|
|
|
|
complete = "complete"
|
|
|
|
|
|
|
|
|
|
|
|
class WorkflowModel(db.Model):
|
|
|
|
__tablename__ = 'workflow'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
2020-01-23 15:53:59 +00:00
|
|
|
bpmn_workflow_json = db.Column(db.JSON)
|
2019-12-18 19:02:17 +00:00
|
|
|
status = db.Column(db.Enum(WorkflowStatus))
|
|
|
|
study_id = db.Column(db.Integer, db.ForeignKey('study.id'))
|
2020-01-06 14:18:13 +00:00
|
|
|
workflow_spec_id = db.Column(db.String, db.ForeignKey('workflow_spec.id'))
|
2020-03-05 20:35:55 +00:00
|
|
|
spec_version = db.Column(db.String)
|