From 812029cf9c02f2791c364d381e885fb6f9d27920 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Tue, 8 Nov 2022 12:38:51 -0500 Subject: [PATCH] script to modify all model json files to use full path for model id. Also removes process_group_id --- spiffworkflow-backend/bin/update_all_json.py | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spiffworkflow-backend/bin/update_all_json.py diff --git a/spiffworkflow-backend/bin/update_all_json.py b/spiffworkflow-backend/bin/update_all_json.py new file mode 100644 index 000000000..0cfbb11f3 --- /dev/null +++ b/spiffworkflow-backend/bin/update_all_json.py @@ -0,0 +1,22 @@ +"""Updates all JSON files, based on the current state of BPMN_SPEC_ABSOLUTE_DIR""" +from spiffworkflow_backend import get_hacked_up_app_for_script +from spiffworkflow_backend.services.process_model_service import ProcessModelService + + +def main() -> None: + """Main.""" + app = get_hacked_up_app_for_script() + with app.app_context(): + + groups = ProcessModelService().get_process_groups() + for group in groups: + for process_model in group.process_models: + update_items = { + 'process_group_id': '', + 'id': f"{group.id}/{process_model.id}" + } + ProcessModelService().update_spec(process_model, update_items) + + +if __name__ == "__main__": + main()