feat(sync-management): rule-based sync scheduling page + API
Phase 1 of unified sync scheduler: - New Prisma model GisSyncRule: per-UAT or per-county sync frequency rules with priority, time windows, step selection (T/C/N/E) - CRUD API: /api/eterra/sync-rules (list, create, update, delete, bulk) - Global default frequency via KeyValueStore - /sync-management page with 3 tabs: - Reguli: table with filters, add dialog (UAT search + county select) - Status: stats cards, frequency distribution, coverage overview - Judete: quick county-level frequency assignment - Monitor page: link to sync management from eTerra actions section Rule resolution: UAT-specific > county default > global default. Scheduler engine (Phase 2) will read these rules to automate syncs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,36 @@ model KeyValueStore {
|
||||
@@index([namespace])
|
||||
}
|
||||
|
||||
// ─── GIS: Sync Scheduling ──────────────────────────────────────────
|
||||
|
||||
model GisSyncRule {
|
||||
id String @id @default(uuid())
|
||||
siruta String? /// Set = UAT-specific rule
|
||||
county String? /// Set = county-wide default rule
|
||||
frequency String /// "3x-daily"|"daily"|"weekly"|"monthly"|"manual"
|
||||
syncTerenuri Boolean @default(true)
|
||||
syncCladiri Boolean @default(true)
|
||||
syncNoGeom Boolean @default(false)
|
||||
syncEnrich Boolean @default(false)
|
||||
priority Int @default(5) /// 1=highest, 10=lowest
|
||||
enabled Boolean @default(true)
|
||||
allowedHoursStart Int? /// null = no restriction, e.g. 1 for 01:00
|
||||
allowedHoursEnd Int? /// e.g. 5 for 05:00
|
||||
allowedDays String? /// e.g. "1,2,3,4,5" for weekdays, null = all days
|
||||
lastSyncAt DateTime?
|
||||
lastSyncStatus String? /// "done"|"error"
|
||||
lastSyncError String?
|
||||
nextDueAt DateTime?
|
||||
label String? /// Human-readable note
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([siruta, county])
|
||||
@@index([enabled, nextDueAt])
|
||||
@@index([county])
|
||||
@@index([frequency])
|
||||
}
|
||||
|
||||
// ─── GIS: eTerra ParcelSync ────────────────────────────────────────
|
||||
|
||||
model GisFeature {
|
||||
|
||||
Reference in New Issue
Block a user