diff --git a/src/components/planes/CreatePlanDialog.tsx b/src/components/planes/CreatePlanDialog.tsx index d4c7e83..8b87184 100644 --- a/src/components/planes/CreatePlanDialog.tsx +++ b/src/components/planes/CreatePlanDialog.tsx @@ -89,8 +89,8 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen async function fetchDbFiles() { try { const { data, error } = await supabase - .from("fine_tuning_referencias") - .select("fine_tuning_referencias_id, titulo_archivo, s3_file_path, fecha_subida, tags") + .from("documentos") + .select("documentos_id, titulo_archivo, s3_file_path, fecha_subida, tags") .ilike("titulo_archivo", `%${debouncedSearchTerm}%`) .range((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage - 1); @@ -100,7 +100,7 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen } setDbFiles((data || []).map((file: any) => ({ - id: file.fine_tuning_referencias_id, + id: file.documentos_id, titulo: file.titulo_archivo, s3_file_path: file.s3_file_path, fecha_subida: file.fecha_subida, @@ -270,7 +270,7 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen onDoubleClick={(e) => { e.stopPropagation(); setPreviewRow({ - fine_tuning_referencias_id: file.id, + documentos_id: file.id, created_by: "unknown", s3_file_path: file.s3_file_path, titulo_archivo: file.titulo, @@ -331,7 +331,7 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen onClick={(e) => { e.stopPropagation(); setPreviewRow({ - fine_tuning_referencias_id: file.id, + documentos_id: file.id, created_by: "unknown", s3_file_path: file.s3_file_path, titulo_archivo: file.titulo, diff --git a/src/routes/_authenticated/archivos.tsx b/src/routes/_authenticated/archivos.tsx index 70e1510..d4ed468 100644 --- a/src/routes/_authenticated/archivos.tsx +++ b/src/routes/_authenticated/archivos.tsx @@ -22,7 +22,7 @@ export const Route = createFileRoute("/_authenticated/archivos")({ component: RouteComponent, loader: async () => { const { data, error } = await supabase - .from("fine_tuning_referencias") + .from("documentos") .select("*") .order("fecha_subida", { ascending: false }) .limit(200) @@ -68,9 +68,9 @@ function RouteComponent() { async function remove(id: string) { if (!confirm("¿Eliminar archivo de referencia?")) return const { error } = await supabase - .from("fine_tuning_referencias") + .from("documentos") .delete() - .eq("fine_tuning_referencias_id", id) + .eq("documentos_id", id) if (error) return alert(error.message) router.invalidate() } @@ -124,7 +124,7 @@ function RouteComponent() {
{filtered.map((r) => (
@@ -166,7 +166,7 @@ function RouteComponent() { -
@@ -237,21 +237,21 @@ function UploadDialog({ try { const payload = await res.json() createdId = - payload?.fine_tuning_referencias_id || + payload?.documentos_id || payload?.id || - payload?.data?.fine_tuning_referencias_id || + payload?.data?.documentos_id || null } catch { /* noop */ } if (createdId && (tags.trim() || fuente.trim() || typeof interno === "boolean")) { await supabase - .from("fine_tuning_referencias") + .from("documentos") .update({ tags: tags.trim() ? tags.split(",").map((s) => s.trim()).filter(Boolean) : undefined, fuente_autoridad: fuente.trim() || undefined, interno, }) - .eq("fine_tuning_referencias_id", createdId) + .eq("documentos_id", createdId) } onOpenChange(false) diff --git a/src/types/RefRow.ts b/src/types/RefRow.ts index 496ac60..5cb707f 100644 --- a/src/types/RefRow.ts +++ b/src/types/RefRow.ts @@ -1,5 +1,5 @@ export type RefRow = { - fine_tuning_referencias_id: string + documentos_id: string titulo_archivo: string | null descripcion: string | null s3_file_path: string | null // Added this property to match the API requirements.