From 3c2ea5f6867f09fe05fd7a4371a00be6295828fc Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 11 Jul 2022 16:56:50 -0400 Subject: [PATCH] precommit is passing w/ burnettk --- migrations/env.py | 2 -- .../models/process_instance_report.py | 5 ++++- .../routes/admin_blueprint/admin_blueprint.py | 4 +++- .../routes/process_api_blueprint.py | 18 +++++++++--------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/migrations/env.py b/migrations/env.py index 68feded2..630e381a 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -1,5 +1,3 @@ -from __future__ import with_statement - import logging from logging.config import fileConfig diff --git a/src/spiffworkflow_backend/models/process_instance_report.py b/src/spiffworkflow_backend/models/process_instance_report.py index 6da9efae..f52c90ff 100644 --- a/src/spiffworkflow_backend/models/process_instance_report.py +++ b/src/spiffworkflow_backend/models/process_instance_report.py @@ -58,7 +58,10 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel): __tablename__ = "process_instance_report" __table_args__ = ( db.UniqueConstraint( - "process_group_identifier", "process_model_identifier", "identifier", name="process_instance_report_unique" + "process_group_identifier", + "process_model_identifier", + "identifier", + name="process_instance_report_unique", ), ) diff --git a/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py b/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py index 180a410d..bdc6c97e 100644 --- a/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py +++ b/src/spiffworkflow_backend/routes/admin_blueprint/admin_blueprint.py @@ -13,7 +13,9 @@ from flask_bpmn.models.db import db from werkzeug.wrappers.response import Response from spiffworkflow_backend.models.principal import PrincipalModel -from spiffworkflow_backend.models.process_instance_report import ProcessInstanceReportModel +from spiffworkflow_backend.models.process_instance_report import ( + ProcessInstanceReportModel, +) from spiffworkflow_backend.models.user import UserModel from spiffworkflow_backend.services.process_instance_processor import ( ProcessInstanceProcessor, diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index 685e3d22..8f3ed573 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -414,26 +414,25 @@ def process_instance_report_list( def process_instance_report_create( - process_group_id: str, process_model_id: str, - body: Dict[str, Any] + process_group_id: str, process_model_id: str, body: Dict[str, Any] ) -> flask.wrappers.Response: """Process_instance_report_create.""" - ProcessInstanceReportModel.create_report( - identifier=body['identifier'], + identifier=body["identifier"], process_group_identifier=process_group_id, process_model_identifier=process_model_id, user=g.user, - report_metadata=body['report_metadata'], + report_metadata=body["report_metadata"], ) return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") def process_instance_report_update( - process_group_id: str, process_model_id: str, + process_group_id: str, + process_model_id: str, report_identifier: str, - body: Dict[str, Any] + body: Dict[str, Any], ) -> flask.wrappers.Response: """Process_instance_report_create.""" process_instance_report = ProcessInstanceReportModel.query.filter_by( @@ -448,14 +447,15 @@ def process_instance_report_update( status_code=404, ) - process_instance_report.report_metadata = body['report_metadata'] + process_instance_report.report_metadata = body["report_metadata"] db.session.commit() return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") def process_instance_report_delete( - process_group_id: str, process_model_id: str, + process_group_id: str, + process_model_id: str, report_identifier: str, ) -> flask.wrappers.Response: """Process_instance_report_create."""