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 contractId = searchParams.get('contractId') const targetSystem = searchParams.get('targetSystem') || 'SHI' const limit = parseInt(searchParams.get('limit') || '10') if (!contractId) { return NextResponse.json( { error: 'Contract ID is required' }, { status: 400 } ) } const batches = await syncService.getRecentSyncBatches( parseInt(contractId), 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 } ) } }