From 1a289879e1a6e87dc09f924fad01ff8f72014685 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Fri, 5 Jul 2024 17:20:35 +0100 Subject: [PATCH] add boundary form validation and table permissions update --- .../Settings/GeneralSettings/BoundaryForm.tsx | 5 +---- hasura.planx.uk/metadata/tables.yaml | 2 ++ package.json | 3 +++ pnpm-lock.yaml | 11 +++++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/BoundaryForm.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/BoundaryForm.tsx index 77ca8b5417..5772e2ee09 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/BoundaryForm.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/BoundaryForm.tsx @@ -37,15 +37,12 @@ export default function BoundaryForm({ formikConfig, onSuccess }: FormProps) { onSubmit: async (values, { resetForm }) => { try { const { data } = await axios.get(`${values.boundaryUrl}.geojson`); - - //lambeth: 626195 - //bmingham: 8600271 const bboxPoly = bboxPolygon(bbox(data)); const bboxFeature = feature(bboxPoly.geometry); const isUpdateSuccess = await useStore.getState().updateTeamSettings({ boundaryUrl: values.boundaryUrl, - boundaryBbox: data, + boundaryBbox: bboxFeature, }); if (isUpdateSuccess) { onSuccess(); diff --git a/hasura.planx.uk/metadata/tables.yaml b/hasura.planx.uk/metadata/tables.yaml index 31b922cac7..1f3505f696 100644 --- a/hasura.planx.uk/metadata/tables.yaml +++ b/hasura.planx.uk/metadata/tables.yaml @@ -1729,6 +1729,7 @@ - role: platformAdmin permission: columns: + - boundary_bbox - boundary_url - email_reply_to_id - external_planning_site_name @@ -1744,6 +1745,7 @@ - role: teamEditor permission: columns: + - boundary_bbox - boundary_url - email_reply_to_id - external_planning_site_name diff --git a/package.json b/package.json index 142ceb0058..f680a98f9a 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,8 @@ "tests": "./scripts/start-containers-for-tests.sh", "analytics": "docker compose -f ./docker-compose.yml -f ./docker-compose.local.yml --profile mock-services --profile analytics up -d --quiet-pull", "logs": "docker compose logs --tail 30 -f" + }, + "dependencies": { + "@types/geojson": "^7946.0.14" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b9f1883a1..30b66b146c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3,3 +3,14 @@ lockfileVersion: '6.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false + +dependencies: + '@types/geojson': + specifier: ^7946.0.14 + version: 7946.0.14 + +packages: + + /@types/geojson@7946.0.14: + resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} + dev: false