mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Revert "improvement(sync): added backwards sync from db"
This reverts commit 6125b2f0b5.
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
}
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user