mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 21:28:32 +00:00
I noticed we were saving the workflow every time we loaded it up, rather than only when we were making changes to it. Refactored this to be a little more careful. Centralized the saving of the workflow into one location in the processor, so we can make sure we update all the details about that workflow every time we save. The workflow service has a method that will log any task action taken in a consistent way. The stats models were removed from the API completely. Will wait for a use case for dealing with this later.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
|
|
|
|
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)
|
|
action = db.Column(db.String)
|
|
task_id = db.Column(db.String)
|
|
task_name = db.Column(db.String)
|
|
task_title = db.Column(db.String)
|
|
task_type = db.Column(db.String)
|
|
task_state = db.Column(db.String)
|
|
mi_type = db.Column(db.String)
|
|
mi_count = db.Column(db.Integer)
|
|
mi_index = db.Column(db.Integer)
|
|
process_name = db.Column(db.String)
|
|
date = db.Column(db.DateTime)
|
|
|
|
|
|
class TaskEventModelSchema(SQLAlchemyAutoSchema):
|
|
class Meta:
|
|
model = TaskEventModel
|
|
load_instance = True
|
|
include_relationships = True
|
|
include_fk = True # Includes foreign keys
|