feat(parcel-sync): add LIMITE_UAT to sync package everywhere

All sync paths now include both admin layers (LIMITE_INTRAV_DYNAMIC +
LIMITE_UAT) as best-effort alongside terenuri + cladiri:
- export-bundle (hero buttons)
- sync-background (fire-and-forget)
- auto-refresh scheduler (weekday nights)
- weekend deep sync (weekend nights)
- freshness check (export tab badge)

LIMITE_UAT rarely changes so incremental sync will skip it almost
every time, but it stays fresh in the DB freshness check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-26 22:13:29 +02:00
parent 8b6d6ba1d0
commit bde25d8d84
5 changed files with 51 additions and 35 deletions
+14
View File
@@ -250,6 +250,20 @@ export async function POST(req: Request) {
pushProgress(); pushProgress();
updatePhaseProgress(2, 2); updatePhaseProgress(2, 2);
} }
// Sync admin layers (lightweight, non-fatal)
for (const adminLayer of ["LIMITE_INTRAV_DYNAMIC", "LIMITE_UAT"]) {
try {
await syncLayer(
validated.username,
validated.password,
validated.siruta,
adminLayer,
{ jobId, isSubStep: true },
);
} catch {
// admin layers are best-effort
}
}
finishPhase(); finishPhase();
/* ══════════════════════════════════════════════════════════ */ /* ══════════════════════════════════════════════════════════ */
+6 -4
View File
@@ -221,20 +221,22 @@ async function runBackground(params: {
throw new Error(r.error ?? "Sync clădiri failed"); throw new Error(r.error ?? "Sync clădiri failed");
} }
// Sync intravilan limits (always, lightweight layer) // Sync admin layers (always, lightweight)
phase = "Sincronizare limite intravilan"; for (const adminLayer of ["LIMITE_INTRAV_DYNAMIC", "LIMITE_UAT"]) {
phase = `Sincronizare ${adminLayer === "LIMITE_UAT" ? "limite UAT" : "limite intravilan"}`;
push({}); push({});
try { try {
await syncLayer(username, password, siruta, "LIMITE_INTRAV_DYNAMIC", { await syncLayer(username, password, siruta, adminLayer, {
forceFullSync: forceSync, forceFullSync: forceSync,
jobId, jobId,
isSubStep: true, isSubStep: true,
}); });
} catch { } catch {
// Non-critical — don't fail the whole job // Non-critical — don't fail the whole job
note = "Avertisment: limite intravilan nu s-au sincronizat"; note = `Avertisment: ${adminLayer} nu s-a sincronizat`;
push({}); push({});
} }
}
if (!terenuriNeedsSync && !cladiriNeedsSync) { if (!terenuriNeedsSync && !cladiriNeedsSync) {
note = "Date proaspete — sync skip"; note = "Date proaspete — sync skip";
@@ -144,7 +144,7 @@ export function ExportTab({
const dbTotalFeatures = dbLayersSummary.reduce((sum, l) => sum + l.count, 0); const dbTotalFeatures = dbLayersSummary.reduce((sum, l) => sum + l.count, 0);
// Primary layers synced by background jobs — these determine freshness // Primary layers synced by background jobs — these determine freshness
const PRIMARY_LAYERS = ["TERENURI_ACTIVE", "CLADIRI_ACTIVE", "LIMITE_INTRAV_DYNAMIC"]; const PRIMARY_LAYERS = ["TERENURI_ACTIVE", "CLADIRI_ACTIVE", "LIMITE_INTRAV_DYNAMIC", "LIMITE_UAT"];
const primaryLayers = dbLayersSummary.filter((l) => const primaryLayers = dbLayersSummary.filter((l) =>
PRIMARY_LAYERS.includes(l.id), PRIMARY_LAYERS.includes(l.id),
); );
@@ -172,17 +172,15 @@ async function runAutoRefresh() {
"CLADIRI_ACTIVE", "CLADIRI_ACTIVE",
{ uatName: uat.name }, { uatName: uat.name },
); );
// Intravilan — lightweight, non-fatal // Admin layers — lightweight, non-fatal
for (const adminLayer of ["LIMITE_INTRAV_DYNAMIC", "LIMITE_UAT"]) {
try { try {
await syncLayer( await syncLayer(username, password, uat.siruta, adminLayer, {
username, uatName: uat.name,
password, });
uat.siruta,
"LIMITE_INTRAV_DYNAMIC",
{ uatName: uat.name },
);
} catch { } catch {
// intravilan is best-effort // admin layers are best-effort
}
} }
const dur = ((Date.now() - start) / 1000).toFixed(1); const dur = ((Date.now() - start) / 1000).toFixed(1);
console.log( console.log(
@@ -186,17 +186,19 @@ async function executeStep(
"TERENURI_ACTIVE", "TERENURI_ACTIVE",
{ uatName: city.name, forceFullSync: true }, { uatName: city.name, forceFullSync: true },
); );
// Also sync intravilan limits (lightweight, non-fatal) // Also sync admin layers (lightweight, non-fatal)
for (const adminLayer of ["LIMITE_INTRAV_DYNAMIC", "LIMITE_UAT"]) {
try { try {
await syncLayer( await syncLayer(
process.env.ETERRA_USERNAME!, process.env.ETERRA_USERNAME!,
process.env.ETERRA_PASSWORD!, process.env.ETERRA_PASSWORD!,
city.siruta, city.siruta,
"LIMITE_INTRAV_DYNAMIC", adminLayer,
{ uatName: city.name }, { uatName: city.name },
); );
} catch { } catch {
// intravilan is best-effort // admin layers are best-effort
}
} }
const dur = ((Date.now() - start) / 1000).toFixed(1); const dur = ((Date.now() - start) / 1000).toFixed(1);
return { return {