From d2ec188373a9664f29b82df5320f98b309f51689 Mon Sep 17 00:00:00 2001 From: mirdono Date: Tue, 3 Jun 2025 18:18:52 +0200 Subject: [PATCH] fix: relate provinces and municipalities in shared graph The frontend relies on the memberships relating municipalities and province to - automatically select the appropriate province given a municipality; and - limit the municipality options to those in a given province. This kind of functionality is used in both the worship and non-worship module so the data should be readable by users with either roles. This moves the appropriate data the `shared` graph, which can be read by all authenticated users. Thereby fixing that that functionality was broken for users with the worship role. --- CHANGELOG.md | 6 +++++ ...icipalities-and-provinces-to-shared.sparql | 24 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 config/migrations/2025/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared.sparql diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f08b0..19398b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog ## Unreleased +### Backend +- datafix: move memberships involving provinces and municipalities to shared graph [OP-3619] +### Deploy notes +``` +drc restart migrations; drc logs -ft --tail=200 migrations +``` ## v1.32.1 (2025-06-02) ### Backend diff --git a/config/migrations/2025/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared.sparql b/config/migrations/2025/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared.sparql new file mode 100644 index 0000000..bb3b48e --- /dev/null +++ b/config/migrations/2025/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared/20250603161306-fix--move-memberships-for-municipalities-and-provinces-to-shared.sparql @@ -0,0 +1,24 @@ +PREFIX org: + +DELETE { + GRAPH { + ?membership ?p ?o . + ?organization org:hasSubOrganization ?member . + } +} INSERT { + GRAPH { + ?membership ?p ?o . + ?organization org:hasSubOrganization ?member . + } +} WHERE { + GRAPH { + ?membership a org:Membership ; + org:member ?member ; + org:organization ?organization ; + ?p ?o . + } + GRAPH { + ?member org:classification . # Municipality + ?organization org:classification . # Province + } +}