2020-03-16 17:37:31 +00:00
|
|
|
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
|
2020-03-11 01:29:57 +00:00
|
|
|
|
|
|
|
from crc import db
|
|
|
|
|
|
|
|
|
|
|
|
class TaskEventModel(db.Model):
|
|
|
|
__tablename__ = 'task_event'
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
study_id = db.Column(db.Integer, db.ForeignKey('study.id'), nullable=False)
|
|
|
|
user_uid = db.Column(db.String, db.ForeignKey('user.uid'), nullable=False)
|
|
|
|
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'), nullable=False)
|
|
|
|
workflow_spec_id = db.Column(db.String, db.ForeignKey('workflow_spec.id'))
|
|
|
|
spec_version = db.Column(db.String)
|
2020-05-04 14:57:09 +00:00
|
|
|
action = db.Column(db.String)
|
2020-03-11 01:29:57 +00:00
|
|
|
task_id = db.Column(db.String)
|
2020-05-04 14:57:09 +00:00
|
|
|
task_name = db.Column(db.String)
|
|
|
|
task_title = db.Column(db.String)
|
|
|
|
task_type = db.Column(db.String)
|
2020-03-11 01:29:57 +00:00
|
|
|
task_state = db.Column(db.String)
|
2020-06-19 12:22:53 +00:00
|
|
|
form_data = db.Column(db.JSON) # And form data submitted when the task was completed.
|
2020-05-04 14:57:09 +00:00
|
|
|
mi_type = db.Column(db.String)
|
|
|
|
mi_count = db.Column(db.Integer)
|
|
|
|
mi_index = db.Column(db.Integer)
|
|
|
|
process_name = db.Column(db.String)
|
2020-03-11 01:29:57 +00:00
|
|
|
date = db.Column(db.DateTime)
|
|
|
|
|
|
|
|
|
2020-03-16 17:37:31 +00:00
|
|
|
class TaskEventModelSchema(SQLAlchemyAutoSchema):
|
2020-03-11 01:29:57 +00:00
|
|
|
class Meta:
|
|
|
|
model = TaskEventModel
|
2020-03-16 17:37:31 +00:00
|
|
|
load_instance = True
|
|
|
|
include_relationships = True
|
2020-03-11 01:29:57 +00:00
|
|
|
include_fk = True # Includes foreign keys
|