Skip to content

Commit

Permalink
Suppression de la definition des cruved du module
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Oct 2, 2023
1 parent 1fcbbbb commit 3bf1844
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion backend/gn_module_monitoring/config/generic/module.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":4, "U":3, "D": 4},
"id_field_name": "id_module",
"description_field_name": "module_label",
"label": "Module",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"id_field_name": "id_observation",
"description_field_name": "id_observation",
"chained": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 0 additions & 1 deletion backend/gn_module_monitoring/config/generic/site.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 1 addition & 3 deletions backend/gn_module_monitoring/config/generic/sites_group.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -60,6 +59,5 @@
"attribut_label": "Médias",
"schema_dot_table": "gn_monitoring.t_sites_groups"
}
}
}
}

1 change: 0 additions & 1 deletion backend/gn_module_monitoring/config/generic/visit.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 0 additions & 5 deletions backend/gn_module_monitoring/modules/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def get_modules():
:return:
"""

modules_out = []

try:
res = DB.session.query(TMonitoringModules).order_by(TMonitoringModules.module_label).all()

Expand 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):
Expand Down
10 changes: 7 additions & 3 deletions backend/gn_module_monitoring/routes/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)


@blueprint.route("/module/<value>", methods=["GET"])
@blueprint.route("/module/<int:value>", methods=["GET"])
@check_cruved_scope("R", module_code=MODULE_CODE)
@json_resp
def get_module_api(value):
Expand All @@ -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

Expand All @@ -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)

Expand Down

0 comments on commit 3bf1844

Please sign in to comment.