summaryrefslogtreecommitdiff
path: root/app/api/sync/batches/route.ts
diff options
context:
space:
mode:
Diffstat (limited to 'app/api/sync/batches/route.ts')
-rw-r--r--app/api/sync/batches/route.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/api/sync/batches/route.ts b/app/api/sync/batches/route.ts
new file mode 100644
index 00000000..a1ef8d26
--- /dev/null
+++ b/app/api/sync/batches/route.ts
@@ -0,0 +1,32 @@
+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 }
+ )
+ }
+} \ No newline at end of file