fix: workspace resolution via ArcGIS listLayer + seed UATs from uat.json

- resolveWorkspace: use listLayer() instead of listLayerByWhere() with
  hardcoded field names. Auto-discovers admin field (ADMIN_UNIT_ID/SIRUTA)
  from ArcGIS layer metadata via buildWhere().
- resolveWorkspace: persist WORKSPACE_ID to DB on first resolution for
  fast subsequent lookups.
- UATs POST: seed from uat.json (correct SIRUTA codes) instead of eTerra
  nomenclature API (nomenPk != SIRUTA, county nomenPk != WORKSPACE_ID).
- Remove eTerra nomenclature dependency from UATs endpoint.
- Fix activeJobs Set iteration error on container restart.
- Remove unused enrichedUatsFetched ref.
This commit is contained in:
AI Assistant
2026-03-06 21:24:51 +02:00
parent 1b72d641cd
commit 6b8feb9075
4 changed files with 107 additions and 210 deletions
@@ -133,14 +133,18 @@ export function getSessionStatus(): SessionStatus {
/* ------------------------------------------------------------------ */
function getRunningJobs(session: EterraSession): string[] {
// Guard: ensure activeJobs is iterable (Set). Containers may restart
// with stale globalThis where the Set was serialized as plain object.
if (!(session.activeJobs instanceof Set)) {
session.activeJobs = new Set();
return [];
}
const running: string[] = [];
for (const jid of session.activeJobs) {
const p = getProgress(jid);
// If progress exists and is still running, count it
if (p && p.status === "running") {
running.push(jid);
} else {
// Clean up finished/unknown jobs
session.activeJobs.delete(jid);
}
}