feat: conectar Tablero CDC a Supabase empresarial

This commit is contained in:
2026-06-01 09:27:26 -04:00
parent a88f106eec
commit c546f59009
8 changed files with 69 additions and 69 deletions
+8 -8
View File
@@ -294,12 +294,12 @@ function startProjectsRealtime() {
.channel("tablero-cdc-projects")
.on(
"postgres_changes",
{ event: "*", schema: "public", table: "projects" },
{ event: "*", schema: "public", table: "tablero_cdc_projects" },
() => scheduleRealtimeRefresh(),
)
.on(
"postgres_changes",
{ event: "*", schema: "public", table: "project_links" },
{ event: "*", schema: "public", table: "tablero_cdc_project_links" },
() => scheduleRealtimeRefresh(),
)
.subscribe((status) => {
@@ -323,7 +323,7 @@ function stopProjectsRealtime() {
async function replaceProjectLinks(projectId: string, project: Pick<Project, "propuestaLinks" | "afLinks">) {
const { error: deleteError } = await supabase
.from("project_links")
.from("tablero_cdc_project_links")
.delete()
.eq("project_id", projectId);
@@ -333,7 +333,7 @@ async function replaceProjectLinks(projectId: string, project: Pick<Project, "pr
if (linkRows.length === 0) return;
const { error: insertError } = await supabase.from("project_links").insert(linkRows);
const { error: insertError } = await supabase.from("tablero_cdc_project_links").insert(linkRows);
if (insertError) throw insertError;
}
@@ -359,7 +359,7 @@ async function loadProjects() {
brief_link,
created_at,
extra_data,
project_links (
project_links:tablero_cdc_project_links (
id,
link_type,
url,
@@ -368,7 +368,7 @@ async function loadProjects() {
`;
const { data, error } = await supabase
.from("projects")
.from("tablero_cdc_projects")
.select(selectColumns)
.order("created_at", { ascending: false });
@@ -399,7 +399,7 @@ async function addProject(project: Project) {
};
const { data, error } = await supabase
.from("projects")
.from("tablero_cdc_projects")
.insert(insertPayload)
.select("id")
.single();
@@ -447,7 +447,7 @@ async function updateProject(id: string, patch: Partial<Project>) {
updated_by: userId,
};
const { error } = await supabase.from("projects").update(updatePayload).eq("id", id);
const { error } = await supabase.from("tablero_cdc_projects").update(updatePayload).eq("id", id);
if (error) {
setError(error.message);