Adds task title and documentation

This commit is contained in:
Aaron Louie 2019-12-20 15:39:02 -05:00
parent 47cc874c06
commit 9b6599505d
2 changed files with 13 additions and 3 deletions

View File

@ -372,15 +372,21 @@ components:
type: string
name:
type: string
title:
type: string
type:
type: string
state:
type: string
form:
$ref: "#/components/schemas/Form"
documentation:
type: string
example:
id: study_identification
name: Study Identification
title: IRB Review
documentation: "# Heading 1\n\nMarkdown documentation text goes here"
type: form
state: ready
form:

View File

@ -70,20 +70,24 @@ class WorkflowSchema(ModelSchema):
class Task:
def __init__(self, id, name, type, state, form):
def __init__(self, id, name, title, type, state, form, documentation):
self.id = id
self.name = name
self.title = title
self.type = type
self.state = state
self.form = form
self.documentation = documentation
@classmethod
def from_spiff(cls, spiff_task):
instance = cls(spiff_task.id,
spiff_task.task_spec.name,
spiff_task.task_spec.description,
spiff_task.get_state_name(),
"task",
{})
{},
spiff_task.task_spec.documentation)
if hasattr(spiff_task.task_spec, "form"):
instance.type = "form"
instance.form = spiff_task.task_spec.form
@ -125,7 +129,7 @@ class FormSchema(ma.Schema):
class TaskSchema(ma.Schema):
class Meta:
fields = ["id", "name", "type", "state", "form"]
fields = ["id", "name", "title", "type", "state", "form", "documentation"]
form = fields.Nested(FormSchema)