feat: add parcel-sync module (eTerra ANCPI integration with PostGIS)
- 31 eTerra layer catalog (terenuri, cladiri, documentatii, administrativ) - Incremental sync engine (OBJECTID comparison, only downloads new features) - PostGIS-ready Prisma schema (GisFeature, GisSyncRun, GisUat models) - 7 API routes (/api/eterra/login, count, sync, features, layers/summary, progress, sync-status) - Full UI with 3 tabs (Sincronizare, Parcele, Istoric) - Env var auth (ETERRA_USERNAME / ETERRA_PASSWORD) - Real-time sync progress tracking with polling
This commit is contained in:
+61
-3
@@ -1,10 +1,12 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["postgresqlExtensions"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
extensions = [postgis]
|
||||
}
|
||||
|
||||
model KeyValueStore {
|
||||
@@ -18,3 +20,59 @@ model KeyValueStore {
|
||||
@@unique([namespace, key])
|
||||
@@index([namespace])
|
||||
}
|
||||
|
||||
// ─── GIS: eTerra ParcelSync ────────────────────────────────────────
|
||||
|
||||
model GisFeature {
|
||||
id String @id @default(uuid())
|
||||
layerId String // e.g. TERENURI_ACTIVE, CLADIRI_ACTIVE
|
||||
siruta String
|
||||
objectId Int // eTerra OBJECTID (unique per layer)
|
||||
inspireId String?
|
||||
cadastralRef String? // NATIONAL_CADASTRAL_REFERENCE
|
||||
areaValue Float?
|
||||
isActive Boolean @default(true)
|
||||
attributes Json // all raw eTerra attributes
|
||||
geometry Json? // GeoJSON geometry (Polygon/MultiPolygon)
|
||||
syncRunId String?
|
||||
projectId String? // link to project tag
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
syncRun GisSyncRun? @relation(fields: [syncRunId], references: [id])
|
||||
|
||||
@@unique([layerId, objectId])
|
||||
@@index([siruta])
|
||||
@@index([cadastralRef])
|
||||
@@index([layerId, siruta])
|
||||
@@index([projectId])
|
||||
}
|
||||
|
||||
model GisSyncRun {
|
||||
id String @id @default(uuid())
|
||||
siruta String
|
||||
uatName String?
|
||||
layerId String
|
||||
status String @default("pending") // pending | running | done | error
|
||||
totalRemote Int @default(0)
|
||||
totalLocal Int @default(0)
|
||||
newFeatures Int @default(0)
|
||||
removedFeatures Int @default(0)
|
||||
startedAt DateTime @default(now())
|
||||
completedAt DateTime?
|
||||
errorMessage String?
|
||||
features GisFeature[]
|
||||
|
||||
@@index([siruta])
|
||||
@@index([layerId])
|
||||
@@index([siruta, layerId])
|
||||
}
|
||||
|
||||
model GisUat {
|
||||
siruta String @id
|
||||
name String
|
||||
county String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user