remove process_group_identifier from process-instances endpoint
This commit is contained in:
parent
207de9ab86
commit
f303c0f77a
|
@ -368,12 +368,6 @@ paths:
|
|||
|
||||
/process-instances:
|
||||
parameters:
|
||||
- name: process_group_identifier
|
||||
in: query
|
||||
required: false
|
||||
description: The unique id of an existing process group
|
||||
schema:
|
||||
type: string
|
||||
- name: process_model_identifier
|
||||
in: query
|
||||
required: false
|
||||
|
|
|
@ -136,6 +136,14 @@ def permissions_check(body: Dict[str, Dict[str, list[str]]]) -> flask.wrappers.R
|
|||
return make_response(jsonify({"results": response_dict}), 200)
|
||||
|
||||
|
||||
def modify_process_model_id(process_model_id: str) -> str:
|
||||
return process_model_id.replace('/', ':')
|
||||
|
||||
|
||||
def un_modify_modified_process_model_id(modified_process_model_id: str) -> str:
|
||||
return modified_process_model_id.replace(':', '/')
|
||||
|
||||
|
||||
def process_group_add(body: dict) -> flask.wrappers.Response:
|
||||
"""Add_process_group."""
|
||||
process_model_service = ProcessModelService()
|
||||
|
@ -400,9 +408,7 @@ def process_instance_create(
|
|||
modified_process_model_id: str
|
||||
) -> flask.wrappers.Response:
|
||||
"""Create_process_instance."""
|
||||
# process_model_id = modified_process_model_id.replace(":", "/")
|
||||
# process_model_identifier = f"{process_group_id}/{process_model_id}"
|
||||
process_model_identifier = modified_process_model_id.replace(":", "/")
|
||||
process_model_identifier = un_modify_modified_process_model_id(modified_process_model_id)
|
||||
process_instance = ProcessInstanceService.create_process_instance(
|
||||
process_model_identifier, g.user
|
||||
)
|
||||
|
@ -651,7 +657,6 @@ def message_start(
|
|||
|
||||
|
||||
def process_instance_list(
|
||||
process_group_identifier: Optional[str] = None,
|
||||
process_model_identifier: Optional[str] = None,
|
||||
page: int = 1,
|
||||
per_page: int = 100,
|
||||
|
@ -662,10 +667,11 @@ def process_instance_list(
|
|||
process_status: Optional[str] = None,
|
||||
) -> flask.wrappers.Response:
|
||||
"""Process_instance_list."""
|
||||
# process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
|
||||
process_instance_query = ProcessInstanceModel.query
|
||||
if process_model_identifier is not None and process_group_identifier is not None:
|
||||
if process_model_identifier is not None:
|
||||
process_model = get_process_model(
|
||||
f"{process_group_identifier}/{process_model_identifier}",
|
||||
f"{process_model_identifier}",
|
||||
)
|
||||
|
||||
process_instance_query = process_instance_query.filter_by(
|
||||
|
|
|
@ -1417,7 +1417,7 @@ class TestProcessApi(BaseTest):
|
|||
|
||||
# Without filtering we should get all 5 instances
|
||||
response = client.get(
|
||||
f"/v1.0/process-instances?process_group_identifier={process_group_id}&process_model_identifier={process_model_id}",
|
||||
f"/v1.0/process-instances?process_model_identifier={process_model_identifier}",
|
||||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
assert response.json is not None
|
||||
|
@ -1428,7 +1428,7 @@ class TestProcessApi(BaseTest):
|
|||
# we should get 1 instance each time
|
||||
for i in range(5):
|
||||
response = client.get(
|
||||
f"/v1.0/process-instances?process_status={ProcessInstanceStatus[statuses[i]].value}&process_group_identifier={process_group_id}&process_model_identifier={process_model_id}",
|
||||
f"/v1.0/process-instances?process_status={ProcessInstanceStatus[statuses[i]].value}&process_model_identifier={process_model_identifier}",
|
||||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
assert response.json is not None
|
||||
|
@ -1437,7 +1437,7 @@ class TestProcessApi(BaseTest):
|
|||
assert results[0]["status"] == ProcessInstanceStatus[statuses[i]].value
|
||||
|
||||
response = client.get(
|
||||
f"/v1.0/process-instances?process_status=not_started,complete&process_group_identifier={process_group_id}&process_model_identifier={process_model_id}",
|
||||
f"/v1.0/process-instances?process_status=not_started,complete&process_model_identifier={process_model_identifier}",
|
||||
headers=self.logged_in_headers(with_super_admin_user),
|
||||
)
|
||||
assert response.json is not None
|
||||
|
|
Loading…
Reference in New Issue