fix(parcel-sync): restore SIRUTA in dropdown, add county debug output

- Restore SIRUTA code display in parentheses next to UAT name
- PATCH response now includes debug samples (sampleUat keys, county
  raw data) visible in browser console for diagnosing matching issues
- POST endpoint now supports resync (upsert mode, safe to call again)
- Client logs full PATCH result to browser console for debugging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-22 21:34:29 +02:00
parent 431291c410
commit 8fa89a7675
2 changed files with 63 additions and 27 deletions
@@ -572,18 +572,32 @@ export function ParcelSyncModule() {
fetch("/api/eterra/uats", { method: "PATCH" })
.then((res) => res.json())
.then((result: { updated?: number; error?: string }) => {
if (result.updated && result.updated > 0) {
// Reload UAT data with fresh county info
fetch("/api/eterra/uats")
.then((res) => res.json())
.then((data: { uats?: UatEntry[] }) => {
if (data.uats && data.uats.length > 0) setUatData(data.uats);
})
.catch(() => {});
}
})
.catch(() => {});
.then(
(result: {
updated?: number;
error?: string;
phase1?: number;
phase2?: number;
codeMatches?: number;
nameMatches?: number;
unmatched?: number;
debug?: unknown;
}) => {
console.log("[uats] County refresh result:", result);
if (result.updated && result.updated > 0) {
// Reload UAT data with fresh county info
fetch("/api/eterra/uats")
.then((res) => res.json())
.then((data: { uats?: UatEntry[] }) => {
if (data.uats && data.uats.length > 0) setUatData(data.uats);
})
.catch(() => {});
}
},
)
.catch((err) => {
console.error("[uats] County refresh failed:", err);
});
}, [session.connected, uatData]);
/* ════════════════════════════════════════════════════════════ */
@@ -1771,8 +1785,11 @@ export function ParcelSyncModule() {
setSearchResults([]);
}}
>
<span className="flex items-center gap-1.5 min-w-0">
<span className="flex items-center gap-1.5 min-w-0 flex-wrap">
<span className="font-medium">{item.name}</span>
<span className="text-muted-foreground">
({item.siruta})
</span>
{item.county && (
<span className="text-muted-foreground">
{" "}
@@ -1787,9 +1804,6 @@ export function ParcelSyncModule() {
</span>
)}
</span>
<span className="text-xs text-muted-foreground font-mono ml-2 shrink-0">
{item.siruta}
</span>
</button>
))}
</div>