From 7774b720f3358bec5bd12b7c8a45cb4aa5f5f1c9 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Fri, 28 Feb 2025 17:34:37 -0800 Subject: [PATCH] Revert "improvement(sync): added backwards sync from db" This reverts commit 6125b2f0b5deb8b778e57ae47dbde9097a7005ef. --- app/api/db/fetch/route.ts | 28 ------ app/api/db/sync/route.ts | 23 ----- app/w/components/control-bar/control-bar.tsx | 4 +- app/w/components/sidebar/sidebar.tsx | 2 +- stores/sync-manager.ts | 99 +------------------- stores/workflow/registry/store.ts | 4 - 6 files changed, 4 insertions(+), 156 deletions(-) delete mode 100644 app/api/db/fetch/route.ts diff --git a/app/api/db/fetch/route.ts b/app/api/db/fetch/route.ts deleted file mode 100644 index 1c44adf33b..0000000000 --- a/app/api/db/fetch/route.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NextResponse } from 'next/server' -import { eq } from 'drizzle-orm' -import { getSession } from '@/lib/auth' -import { db } from '@/db' -import { workflow } from '@/db/schema' - -export async function GET(request: Request) { - try { - const session = await getSession() - if (!session?.user?.id) { - return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) - } - - // Fetch all workflows for the current user - const userWorkflows = await db - .select() - .from(workflow) - .where(eq(workflow.userId, session.user.id)) - - return NextResponse.json({ - success: true, - workflows: userWorkflows, - }) - } catch (error) { - console.error('Fetch workflows error:', error) - return NextResponse.json({ error: 'Failed to fetch workflows' }, { status: 500 }) - } -} diff --git a/app/api/db/sync/route.ts b/app/api/db/sync/route.ts index 86cfc279bd..be09b36a87 100644 --- a/app/api/db/sync/route.ts +++ b/app/api/db/sync/route.ts @@ -81,26 +81,3 @@ export async function POST(request: Request) { return NextResponse.json({ error: 'Batch sync failed' }, { status: 500 }) } } - -export async function GET(request: Request) { - try { - const session = await getSession() - if (!session?.user?.id) { - return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) - } - - // Fetch all workflows for the current user - const userWorkflows = await db - .select() - .from(workflow) - .where(eq(workflow.userId, session.user.id)) - - return NextResponse.json({ - success: true, - workflows: userWorkflows, - }) - } catch (error) { - console.error('Fetch workflows error:', error) - return NextResponse.json({ error: 'Failed to fetch workflows' }, { status: 500 }) - } -} diff --git a/app/w/components/control-bar/control-bar.tsx b/app/w/components/control-bar/control-bar.tsx index 40890429db..21a1090d9d 100644 --- a/app/w/components/control-bar/control-bar.tsx +++ b/app/w/components/control-bar/control-bar.tsx @@ -190,9 +190,7 @@ export function ControlBar() { className="font-semibold text-sm hover:text-muted-foreground w-fit" onClick={handleNameClick} > - {activeWorkflowId && workflows[activeWorkflowId] - ? workflows[activeWorkflowId].name - : 'Workflow'} + {activeWorkflowId ? workflows[activeWorkflowId].name : 'Workflow'} )} {mounted && ( diff --git a/app/w/components/sidebar/sidebar.tsx b/app/w/components/sidebar/sidebar.tsx index 766956ed7e..f08f7ea321 100644 --- a/app/w/components/sidebar/sidebar.tsx +++ b/app/w/components/sidebar/sidebar.tsx @@ -69,7 +69,7 @@ export function Sidebar() { {/* Scrollable workflows section */}