Install and reconcile module workflow standards
This commit is contained in:
@@ -21,6 +21,7 @@ from govoplan_workflow_engine.backend.governance import (
|
||||
require_definition_action,
|
||||
)
|
||||
from govoplan_workflow_engine.backend.contributions import (
|
||||
compare_workflow_override_to_standard,
|
||||
reconcile_workflow_definition_contributions,
|
||||
reset_workflow_override_to_standard,
|
||||
)
|
||||
@@ -87,6 +88,7 @@ from govoplan_workflow_engine.backend.schemas import (
|
||||
WorkflowNodeLibraryResponse,
|
||||
WorkflowNodeTypeResponse,
|
||||
WorkflowPortResponse,
|
||||
WorkflowStandardDiffResponse,
|
||||
WorkflowStepActionRequest,
|
||||
)
|
||||
from govoplan_workflow_engine.backend.instance_service import (
|
||||
@@ -819,6 +821,41 @@ def api_reset_definition_to_standard(
|
||||
return response
|
||||
|
||||
|
||||
@router.get(
|
||||
"/definitions/{definition_id}/standard-diff",
|
||||
response_model=WorkflowStandardDiffResponse,
|
||||
)
|
||||
def api_compare_definition_to_standard(
|
||||
definition_id: str,
|
||||
include_unchanged: bool = False,
|
||||
session: Session = Depends(get_session),
|
||||
principal: ApiPrincipal = Depends(get_api_principal),
|
||||
) -> WorkflowStandardDiffResponse:
|
||||
_require_any_scope(principal, DEFINITION_READ_SCOPE, ADMIN_SCOPE)
|
||||
try:
|
||||
definition = get_definition(
|
||||
session,
|
||||
tenant_id=principal.tenant_id,
|
||||
definition_id=definition_id,
|
||||
)
|
||||
require_definition_action(
|
||||
definition,
|
||||
principal=principal,
|
||||
registry=get_registry(),
|
||||
action="view",
|
||||
)
|
||||
return compare_workflow_override_to_standard(
|
||||
session,
|
||||
tenant_id=principal.tenant_id,
|
||||
definition_id=definition_id,
|
||||
include_unchanged=include_unchanged,
|
||||
)
|
||||
except PermissionError as exc:
|
||||
raise _governance_http_error(exc) from exc
|
||||
except WorkflowError as exc:
|
||||
raise _http_error(exc) from exc
|
||||
|
||||
|
||||
@router.get(
|
||||
"/instances/{instance_id}",
|
||||
response_model=WorkflowInstanceResponse,
|
||||
|
||||
Reference in New Issue
Block a user