feat(geoportal-v2): swap refresh path to /parcel/enrich (deep-enrich)

gis-api session shipped PR3 (gis-api 09f1ab8 + gis-sync-orchestrator
0371d81): new POST /api/v1/parcel/enrich does the full eTerra
round-trip (searchImmovableByIdentifier → fetchDocumentationData
→ fetchImmovableParcelDetails) and merges NR_CF / ADRESA / PROPRIETARI
+ 20-plus fields into gis_core.GisFeature.enrichment with a 30-day
cache. Verified on 266888 + 328607 → 27 keys with full PII.

Wired in three places:

1. src/lib/gis-api-client.ts — gisApi.parcel.enrich({siruta,
   cadastralRef, force?}) thin wrapper.

2. src/app/api/gis/parcel/enrich/route.ts — architots-side proxy,
   matches the parcel/tech pattern (auth check → forward → bubble up
   GisApiError status codes).

3. src/modules/geoportal/v2/feature-info-panel.tsx — refreshFromAncpi
   now POSTs to /api/gis/parcel/enrich instead of /api/gis/parcel/tech.
   After the orchestrator returns, the panel re-fetches the canonical
   record via parcela.get (when uuid known) or parcela.find (when
   not), so it sees exactly what gis_core stores rather than the
   orchestrator response shape.

The existing auto-trigger (fires when detail has no NR_CF/ADRESA/
PROPRIETARI) now actually fills those fields. Subsequent clicks on the
same parcel hit gis-api's 30-day cache (5ms vs 1-2s live fetch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude VM
2026-05-19 22:24:02 +03:00
parent 87f9d72e4f
commit 02a466ccaa
3 changed files with 83 additions and 18 deletions
+11
View File
@@ -270,6 +270,17 @@ export const gisApi = {
body: JSON.stringify(body),
accessToken: opts.accessToken,
}),
// Deep-enrich (PR3 / gis-api 09f1ab8): orchestrator looks up eTerra
// immovable, fetches documentation + parcel details, parses NR_CF +
// ADRESA + PROPRIETARI + 20+ more fields and merges into gis_core.
// Cache TTL ~30d; pass force=true to bypass.
enrich: (body: ParcelRefBody, opts: GisApiCallOpts = {}) =>
request<unknown>("/api/v1/parcel/enrich", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
accessToken: opts.accessToken,
}),
unitsFetch: (body: ParcelRefBody, opts: GisApiCallOpts = {}) =>
request<unknown>("/api/v1/parcel/units/fetch", {
method: "POST",