feat(parcel-sync): sync-first architecture — DB as ground truth
- Rewrite export-bundle to sync-first: check freshness -> sync layers -> enrich (magic) -> build GPKG/CSV from local DB - Rewrite export-layer-gpkg to sync-first: sync if stale -> export from DB - Create enrich-service.ts: extracted magic enrichment logic (CF, owners, addresses) with DB storage - Add enrichment + enrichedAt columns to GisFeature schema - Update PostGIS views to include enrichment data - UI: update button labels for sync-first semantics, refresh sync status after exports - Smart caching: skip sync if data is fresh (168h / 1 week default)
This commit is contained in:
@@ -78,6 +78,8 @@ SELECT
|
||||
"areaValue" AS area_value,
|
||||
"isActive" AS is_active,
|
||||
attributes,
|
||||
enrichment,
|
||||
"enrichedAt" AS enriched_at,
|
||||
"projectId" AS project_id,
|
||||
"createdAt" AS created_at,
|
||||
"updatedAt" AS updated_at,
|
||||
|
||||
@@ -34,6 +34,8 @@ model GisFeature {
|
||||
geometry Json? // GeoJSON geometry (Polygon/MultiPolygon)
|
||||
// NOTE: native PostGIS column 'geom' is managed via SQL trigger (see prisma/postgis-setup.sql)
|
||||
// Prisma doesn't need to know about it — trigger auto-populates from geometry JSON
|
||||
enrichment Json? // magic data: CF, owners, address, categories, etc.
|
||||
enrichedAt DateTime? // when enrichment was last fetched
|
||||
syncRunId String?
|
||||
projectId String? // link to project tag
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
Reference in New Issue
Block a user