Group of actions. Ie a user creates a flow where an Action A then Action B happens
| 17 | |
| 18 | |
| 19 | class Workflow(Base): |
| 20 | """ |
| 21 | |
| 22 | Group of actions. |
| 23 | Ie a user creates a flow where an Action A then Action B happens |
| 24 | |
| 25 | |
| 26 | """ |
| 27 | |
| 28 | __tablename__ = 'workflow' |
| 29 | id = Column(Integer, primary_key = True) |
| 30 | |
| 31 | name = Column(String()) |
| 32 | string_id = Column(String()) |
| 33 | |
| 34 | time_window = Column(String()) |
| 35 | |
| 36 | active = Column(Boolean) # Running / not running |
| 37 | archived = Column(Boolean, default = False) # Hide from list |
| 38 | is_new = Column(Boolean, default = True) |
| 39 | |
| 40 | kind = Column(String()) |
| 41 | |
| 42 | trigger_type = Column(String()) # Reference types from ActionFlowTriggerEventQueue |
| 43 | |
| 44 | count_events = Column(Integer) |
| 45 | |
| 46 | # New Jun 18 2019 foreign key not added yet |
| 47 | directory_id = Column(Integer, ForeignKey('working_dir.id')) |
| 48 | directory = relationship("WorkingDir", |
| 49 | foreign_keys = [directory_id]) |
| 50 | |
| 51 | first_action_id = Column(BIGINT, ForeignKey('action.id')) |
| 52 | first_action = relationship(Action, foreign_keys = [first_action_id]) |
| 53 | |
| 54 | last_action_id = Column(BIGINT, ForeignKey('action.id')) |
| 55 | last_action = relationship(Action, foreign_keys = [last_action_id]) |
| 56 | |
| 57 | project_id = Column(Integer, ForeignKey('project.id')) |
| 58 | project = relationship("Project") |
| 59 | |
| 60 | org_id = Column(Integer, ForeignKey('org.id')) |
| 61 | org = relationship("Org", foreign_keys = [org_id]) |
| 62 | |
| 63 | member_created_id = Column(Integer, ForeignKey('member.id')) |
| 64 | member_created = relationship("Member", foreign_keys = [member_created_id]) |
| 65 | |
| 66 | member_updated_id = Column(Integer, ForeignKey('member.id')) |
| 67 | member_updated = relationship("Member", foreign_keys = [member_updated_id]) |
| 68 | |
| 69 | time_created = Column(DateTime, default = datetime.datetime.utcnow) |
| 70 | time_updated = Column(DateTime, onupdate = datetime.datetime.utcnow) |
| 71 | |
| 72 | @staticmethod |
| 73 | def new( |
| 74 | session, |
| 75 | project, |
| 76 | org, |