Skip to content

Commit

Permalink
fix: check for multidomains in areas
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Feb 22, 2024
1 parent f470f53 commit e5b8a9c
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions server/src/services/areas.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,20 @@ const loadLatestAreas = async () => {
/** @type {Record<string, import("@rm/types").RMGeoJSON>} */
const scanAreas = {
main: await loadScanPolygons(fileName),
...Object.fromEntries(
await Promise.all(
config
.getSafe('multiDomains')
.map(async (d) => [
d.general?.geoJsonFileName ? d.domain.replaceAll('.', '_') : 'main',
await loadScanPolygons(d.general?.geoJsonFileName || fileName),
]),
),
),
...(config.has('multiDomains')
? Object.fromEntries(
await Promise.all(
config
.getSafe('multiDomains')
.map(async (d) => [
d.general?.geoJsonFileName
? d.domain.replaceAll('.', '_')
: 'main',
await loadScanPolygons(d.general?.geoJsonFileName || fileName),
]),
),
)
: {}),
}
return buildAreas(scanAreas)
}
Expand All @@ -353,14 +357,18 @@ const loadCachedAreas = () => {
/** @type {Record<string, import("@rm/types").RMGeoJSON>} */
const scanAreas = {
main: loadFromFile(fileName),
...Object.fromEntries(
config
.getSafe('multiDomains')
.map((d) => [
d.general?.geoJsonFileName ? d.domain.replaceAll('.', '_') : 'main',
loadFromFile(d.general?.geoJsonFileName || fileName),
]),
),
...(config.has('multiDomains')
? Object.fromEntries(
config
.getSafe('multiDomains')
.map((d) => [
d.general?.geoJsonFileName
? d.domain.replaceAll('.', '_')
: 'main',
loadFromFile(d.general?.geoJsonFileName || fileName),
]),
)
: {}),
}
return buildAreas(scanAreas)
}
Expand Down

0 comments on commit e5b8a9c

Please sign in to comment.