Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 07:21:46 +00:00
co-authored by renee-png
parent c41ff210a2
commit 4dc14bf9bd
+12 -3
View File
@@ -595,15 +595,24 @@ function ImportPage() {
}
ctx.caseByExt.clear();
ctx.caseByNumber.clear();
const cases = await fetchAllPaginated<{ id: string; case_number: string | null; external_id: string | null }>(
ctx.caseByTitle.clear();
const cases = await fetchAllPaginated<{ id: string; case_number: string | null; title: string | null; external_id: string | null }>(
"cases",
"id, case_number, external_id",
"id, case_number, title, external_id",
);
for (const r of cases) {
if (r.external_id) ctx.caseByExt.set(r.external_id, r.id);
if (r.case_number) ctx.caseByNumber.set(r.case_number, r.id);
if (r.title) ctx.caseByTitle.set(r.title.toLowerCase().trim(), r.id);
}
console.info(`[import] lookups loaded: clients=${ctx.clientByExt.size}/${ctx.clientByName.size} cases=${ctx.caseByExt.size}/${ctx.caseByNumber.size}`);
ctx.userByName.clear();
ctx.userByEmail.clear();
const { data: profs } = await supabase.from("profiles").select("id, full_name, email");
for (const p of (profs ?? []) as { id: string; full_name: string | null; email: string | null }[]) {
if (p.full_name) ctx.userByName.set(p.full_name.toLowerCase().trim(), p.id);
if (p.email) ctx.userByEmail.set(p.email.toLowerCase().trim(), p.id);
}
console.info(`[import] lookups loaded: clients=${ctx.clientByExt.size}/${ctx.clientByName.size} cases=${ctx.caseByExt.size}/${ctx.caseByNumber.size}/${ctx.caseByTitle.size} users=${ctx.userByName.size}`);
};
const handleFile = async (cfg: ImporterConfig, file: File) => {