From 840d1514e493a584d4ec8990190827f683d2faa7 Mon Sep 17 00:00:00 2001 From: viet nguyen Date: Sat, 20 Jan 2024 12:25:04 -0800 Subject: [PATCH 1/2] fix: add id back to geojson props --- src/db/utils/jobs/CragGeojson/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/db/utils/jobs/CragGeojson/index.ts b/src/db/utils/jobs/CragGeojson/index.ts index 24f5f9df..b1117fb0 100644 --- a/src/db/utils/jobs/CragGeojson/index.ts +++ b/src/db/utils/jobs/CragGeojson/index.ts @@ -27,6 +27,7 @@ async function exportLeafCrags (): Promise { const ancestorArray = ancestors.split(',') const pointFeature = point(doc.metadata.lnglat.coordinates, { + id: metadata.area_id.toUUID().toString(), name: areaName, type: 'crag', content, @@ -34,8 +35,6 @@ async function exportLeafCrags (): Promise { id: ancestorArray[ancestorArray.length - 2], name: pathTokens[doc.pathTokens.length - 2] } - }, { - id: metadata.area_id.toUUID().toString() }) features.push(pointFeature) } @@ -122,11 +121,10 @@ async function exportCragGroups (): Promise { for await (const doc of rs) { const polygonFeature = feature(doc.polygon, { type: 'crag-group', + id: doc.uuid.toUUID().toString(), name: doc.name, children: doc.childAreaList.map(({ uuid, name, leftRightIndex }) => ( { id: uuid.toUUID().toString(), name, lr: leftRightIndex })) - }, { - id: doc.uuid.toUUID().toString() }) features.push(polygonFeature) } From 5020534bddb1fee8e62b09223b0eb60abaeaa5bb Mon Sep 17 00:00:00 2001 From: viet nguyen Date: Sat, 20 Jan 2024 12:29:21 -0800 Subject: [PATCH 2/2] redundance IDs but future-proof --- src/db/utils/jobs/CragGeojson/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/db/utils/jobs/CragGeojson/index.ts b/src/db/utils/jobs/CragGeojson/index.ts index b1117fb0..41b5387a 100644 --- a/src/db/utils/jobs/CragGeojson/index.ts +++ b/src/db/utils/jobs/CragGeojson/index.ts @@ -35,6 +35,8 @@ async function exportLeafCrags (): Promise { id: ancestorArray[ancestorArray.length - 2], name: pathTokens[doc.pathTokens.length - 2] } + }, { + id: metadata.area_id.toUUID().toString() }) features.push(pointFeature) } @@ -125,6 +127,8 @@ async function exportCragGroups (): Promise { name: doc.name, children: doc.childAreaList.map(({ uuid, name, leftRightIndex }) => ( { id: uuid.toUUID().toString(), name, lr: leftRightIndex })) + }, { + id: doc.uuid.toUUID().toString() }) features.push(polygonFeature) }