From e1b34ef754499433568e679b1c7cf209177391ae Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 00:34:13 +0000 Subject: [PATCH 1/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 2a19b21..6dae765 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -746,10 +746,10 @@ function ImportPage() { const withConflict = chunk.filter((r) => r[cfg.conflict]); const withoutConflict = chunk.filter((r) => !r[cfg.conflict]); - if (cfg.table === "time_entries" && withConflict.length > 0) { + if ((cfg.table === "time_entries" || cfg.table === "invoices") && withConflict.length > 0) { const externalIds = withConflict.map((r) => String(r[cfg.conflict])); const { data: existing, error: lookupError } = await supabase - .from("time_entries") + .from(cfg.table as any) .select("id, external_id") .in("external_id", externalIds); From cc3aa5845a96aa0e1154e9fc27cd9b192d6ce499 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 00:34:37 +0000 Subject: [PATCH 2/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6dae765..ab2f556 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -757,7 +757,9 @@ function ImportPage() { errors.push(`Batch ${i / chunkSize + 1} (lookup): ${lookupError.message}`); } else { const existingByExternalId = new Map( - (existing ?? []).map((entry: { id: string; external_id: string | null }) => [entry.external_id, entry.id]), + ((existing ?? []) as Array<{ id: string; external_id: string | null }>).map( + (entry) => [entry.external_id, entry.id] as [string | null, string], + ), ); const toUpdate: Array = withConflict .filter((r) => existingByExternalId.has(String(r.external_id))) @@ -768,7 +770,7 @@ function ImportPage() { const updateResults = await Promise.all( toUpdate.map(async (entry) => { const { id, ...payload } = entry; - return supabase.from("time_entries").update(payload as any).eq("id", id).select("*").single(); + return supabase.from(cfg.table as any).update(payload as any).eq("id", id).select("*").single(); }), ); for (const result of updateResults) { @@ -776,21 +778,21 @@ function ImportPage() { errors.push(`Batch ${i / chunkSize + 1} (update): ${result.error.message}`); } else if (result.data) { inserted += 1; - inserted_rows.push(result.data); + inserted_rows.push(result.data as Row); } } } if (toInsert.length > 0) { const { data, error } = await supabase - .from("time_entries") + .from(cfg.table as any) .insert(toInsert as any) .select("*"); if (error) { errors.push(`Batch ${i / chunkSize + 1} (insert): ${error.message}`); } else if (data) { inserted += data.length; - inserted_rows.push(...data); + inserted_rows.push(...(data as Row[])); } } } From 30d1b9cc8465eb2aa936b459f6ffe2d5a0dd01cb Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 00:34:43 +0000 Subject: [PATCH 3/3] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index ab2f556..91642b3 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -757,7 +757,7 @@ function ImportPage() { errors.push(`Batch ${i / chunkSize + 1} (lookup): ${lookupError.message}`); } else { const existingByExternalId = new Map( - ((existing ?? []) as Array<{ id: string; external_id: string | null }>).map( + ((existing ?? []) as unknown as Array<{ id: string; external_id: string | null }>).map( (entry) => [entry.external_id, entry.id] as [string | null, string], ), );