7cdea66fa2
- 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
25 lines
667 B
TypeScript
25 lines
667 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getProgress } from "@/modules/parcel-sync/services/progress-store";
|
|
|
|
export const runtime = "nodejs";
|
|
export const dynamic = "force-dynamic";
|
|
|
|
/**
|
|
* GET /api/eterra/progress?jobId=...
|
|
* Poll sync progress for a running job.
|
|
*/
|
|
export async function GET(req: Request) {
|
|
const url = new URL(req.url);
|
|
const jobId = url.searchParams.get("jobId");
|
|
if (!jobId) {
|
|
return NextResponse.json({ error: "jobId obligatoriu" }, { status: 400 });
|
|
}
|
|
|
|
const progress = getProgress(jobId);
|
|
if (!progress) {
|
|
return NextResponse.json({ jobId, status: "unknown" });
|
|
}
|
|
|
|
return NextResponse.json(progress);
|
|
}
|