From 3bf184482880d98fb747f1cf3a68a610c2a87d41 Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Mon, 2 Oct 2023 16:41:16 +0200 Subject: [PATCH] Suppression de la definition des cruved du module --- .../gn_module_monitoring/config/generic/module.json | 1 - .../config/generic/observation.json | 1 - .../config/generic/observation_detail.json | 1 - backend/gn_module_monitoring/config/generic/site.json | 1 - .../config/generic/sites_group.json | 4 +--- backend/gn_module_monitoring/config/generic/visit.json | 1 - backend/gn_module_monitoring/modules/repositories.py | 5 ----- backend/gn_module_monitoring/routes/modules.py | 10 +++++++--- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/backend/gn_module_monitoring/config/generic/module.json b/backend/gn_module_monitoring/config/generic/module.json index 1dc10d140..352a5dacf 100644 --- a/backend/gn_module_monitoring/config/generic/module.json +++ b/backend/gn_module_monitoring/config/generic/module.json @@ -1,5 +1,4 @@ { - "cruved": {"C":4, "U":3, "D": 4}, "id_field_name": "id_module", "description_field_name": "module_label", "label": "Module", diff --git a/backend/gn_module_monitoring/config/generic/observation.json b/backend/gn_module_monitoring/config/generic/observation.json index f46cfb840..5788fd4a9 100644 --- a/backend/gn_module_monitoring/config/generic/observation.json +++ b/backend/gn_module_monitoring/config/generic/observation.json @@ -1,5 +1,4 @@ { - "cruved": {"C":1, "U":1, "D": 1}, "id_field_name": "id_observation", "description_field_name": "id_observation", "chained": true, diff --git a/backend/gn_module_monitoring/config/generic/observation_detail.json b/backend/gn_module_monitoring/config/generic/observation_detail.json index 3bf271a00..56ada4c4e 100644 --- a/backend/gn_module_monitoring/config/generic/observation_detail.json +++ b/backend/gn_module_monitoring/config/generic/observation_detail.json @@ -1,5 +1,4 @@ { - "cruved": {"C":1, "U":1, "D": 1}, "id_field_name": "id_observation_detail", "description_field_name": "id_observation_detail", "chained": true, diff --git a/backend/gn_module_monitoring/config/generic/site.json b/backend/gn_module_monitoring/config/generic/site.json index 2264755b2..da4956690 100644 --- a/backend/gn_module_monitoring/config/generic/site.json +++ b/backend/gn_module_monitoring/config/generic/site.json @@ -1,5 +1,4 @@ { - "cruved": {"C":1, "U":1, "D": 1}, "chained": true, "id_field_name": "id_base_site", "description_field_name": "base_site_name", diff --git a/backend/gn_module_monitoring/config/generic/sites_group.json b/backend/gn_module_monitoring/config/generic/sites_group.json index fc7c96d57..68bdf820d 100644 --- a/backend/gn_module_monitoring/config/generic/sites_group.json +++ b/backend/gn_module_monitoring/config/generic/sites_group.json @@ -1,5 +1,4 @@ { - "cruved": {"C":1, "U":1, "D": 1}, "id_field_name": "id_sites_group", "chained": true, "description_field_name": "sites_group_name", @@ -60,6 +59,5 @@ "attribut_label": "Médias", "schema_dot_table": "gn_monitoring.t_sites_groups" } - } + } } - \ No newline at end of file diff --git a/backend/gn_module_monitoring/config/generic/visit.json b/backend/gn_module_monitoring/config/generic/visit.json index 066b4953b..f46bdf8c6 100644 --- a/backend/gn_module_monitoring/config/generic/visit.json +++ b/backend/gn_module_monitoring/config/generic/visit.json @@ -1,5 +1,4 @@ { - "cruved": {"C":1, "U":1, "D": 1}, "id_field_name": "id_base_visit", "chained": true, "description_field_name": "visit_date_min", diff --git a/backend/gn_module_monitoring/modules/repositories.py b/backend/gn_module_monitoring/modules/repositories.py index c186495de..75aaa6070 100644 --- a/backend/gn_module_monitoring/modules/repositories.py +++ b/backend/gn_module_monitoring/modules/repositories.py @@ -78,8 +78,6 @@ def get_modules(): :return: """ - modules_out = [] - try: res = DB.session.query(TMonitoringModules).order_by(TMonitoringModules.module_label).all() @@ -88,9 +86,6 @@ def get_modules(): except Exception as e: raise GeoNatureError("MONITORINGS - get_modules : {}".format(str(e))) # en cas d'erreur on revoie [] - pass - - return modules_out def get_source_by_code(value): diff --git a/backend/gn_module_monitoring/routes/modules.py b/backend/gn_module_monitoring/routes/modules.py index e0ea12889..c12d7d3fa 100644 --- a/backend/gn_module_monitoring/routes/modules.py +++ b/backend/gn_module_monitoring/routes/modules.py @@ -19,7 +19,7 @@ ) -@blueprint.route("/module/", methods=["GET"]) +@blueprint.route("/module/", methods=["GET"]) @check_cruved_scope("R", module_code=MODULE_CODE) @json_resp def get_module_api(value): @@ -37,7 +37,9 @@ def get_module_api(value): module_out = [] if module: module_out = module.as_dict(depth=depth) - module_out["cruved"] = get_scopes_by_action(module_code=module.module_code) + module_out["cruved"] = get_scopes_by_action( + module_code=module.module_code, object_code="MONITORINGS_MODULES" + ) return module_out @@ -56,7 +58,9 @@ def get_modules_api(): modules = get_modules() for module in modules: module_out = module.as_dict(depth=depth) - module_out["cruved"] = get_scopes_by_action(module_code=module.module_code) + module_out["cruved"] = get_scopes_by_action( + module_code=module.module_code, object_code="MONITORINGS_MODULES" + ) modules_out.append(module_out)