//api/sync/batches/route.ts import { syncService } from "@/lib/vendor-document-list/sync-service" import { NextRequest, NextResponse } from "next/server" export async function GET(request: NextRequest) { try { const { searchParams } = new URL(request.url) const projectId = searchParams.get('projectId') const targetSystem = searchParams.get('targetSystem') || 'SHI' const limit = parseInt(searchParams.get('limit') || '10') if (!projectId) { return NextResponse.json( { error: 'Vendor ID is required' }, { status: 400 } ) } const batches = await syncService.getRecentSyncBatches( parseInt(projectId), targetSystem, limit ) return NextResponse.json(batches) } catch (error) { console.error('Failed to get sync batches:', error) return NextResponse.json( { error: 'Failed to get sync batches' }, { status: 500 } ) } }