mypy cleanup

This commit is contained in:
mike cullerton 2022-06-30 11:50:42 -04:00
parent 16da394bd6
commit 6e0e7b847f
4 changed files with 15 additions and 10 deletions

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from typing import Optional
import marshmallow
from flask_bpmn.models.db import db
@ -17,6 +18,7 @@ from sqlalchemy.orm import relationship
from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum
from spiffworkflow_backend.models.process_model import ProcessModelInfo
from spiffworkflow_backend.models.task import Task
from spiffworkflow_backend.models.task import TaskSchema
from spiffworkflow_backend.models.user import UserModel
@ -143,7 +145,7 @@ class ProcessInstanceApi:
self,
id: int,
status: ProcessInstanceStatus,
next_task: None,
next_task: Optional[Task],
process_model_identifier: str,
process_group_identifier: str,
total_tasks: int,

View File

@ -102,7 +102,7 @@ class Task:
type: str,
state: str,
lane: str,
form: Optional[Form],
form: None,
documentation: str,
data: dict[str, Any],
multi_instance_type: MultiInstanceType,
@ -117,7 +117,7 @@ class Task:
self.title = title
self.type = type
self.state = state
self.form = form
self.form = None
self.documentation = documentation
self.data = data
self.lane = lane
@ -200,11 +200,11 @@ class FormFieldSchema(Schema):
)
class FormSchema(Schema):
"""FormSchema."""
key = marshmallow.fields.String(required=True, allow_none=False)
fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
# class FormSchema(Schema):
# """FormSchema."""
#
# key = marshmallow.fields.String(required=True, allow_none=False)
# fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
class TaskSchema(Schema):
@ -232,7 +232,7 @@ class TaskSchema(Schema):
multi_instance_type = EnumField(MultiInstanceType)
documentation = marshmallow.fields.String(required=False, allow_none=True)
form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
# form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
title = marshmallow.fields.String(required=False, allow_none=True)
process_name = marshmallow.fields.String(required=False, allow_none=True)
lane = marshmallow.fields.String(required=False, allow_none=True)

View File

@ -447,7 +447,7 @@ def task_list_my_tasks(page: int = 1, per_page: int = 100) -> flask.wrappers.Res
active_tasks = (
ActiveTaskModel.query.filter_by(assigned_principal_id=principal.id)
.order_by(desc(ActiveTaskModel.id))
.order_by(desc(ActiveTaskModel.id)) # type: ignore
.paginate(page, per_page, False)
)

View File

@ -110,6 +110,9 @@ class ProcessInstanceService:
next_task_trying_again, add_docs_and_forms=True
)
)
# TODO: Hack for now, until we decide how to implment forms
process_instance_api.next_task.form = None
# Update the state of the task to locked if the current user does not own the task.
# user_uids = WorkflowService.get_users_assigned_to_task(processor, next_task)
# if not UserService.in_list(user_uids, allow_admin_impersonate=True):