summaryrefslogtreecommitdiff
path: root/app/api/sync/import/status/route.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-06-05 01:53:35 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-06-05 01:53:35 +0000
commit610d3bccf1cb640e2a21df28d8d2a954c2bf337e (patch)
treee7e6d72fecf14ddcff1b5b52263d14119b7c488c /app/api/sync/import/status/route.ts
parent15969dfedffc4e215c81d507164bc2bb383974e5 (diff)
(대표님) 변경사항 0604 - OCR 관련 및 drizzle generated sqls
Diffstat (limited to 'app/api/sync/import/status/route.ts')
-rw-r--r--app/api/sync/import/status/route.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/app/api/sync/import/status/route.ts b/app/api/sync/import/status/route.ts
new file mode 100644
index 00000000..c5b4b0bd
--- /dev/null
+++ b/app/api/sync/import/status/route.ts
@@ -0,0 +1,41 @@
+// app/api/sync/import/status/route.ts
+import { NextRequest, NextResponse } from "next/server"
+import { importService } from "@/lib/vendor-document-list/import-service"
+import { getServerSession } from "next-auth"
+import { authOptions } from "@/app/api/auth/[...nextauth]/route"
+
+export async function GET(request: NextRequest) {
+ try {
+ const session = await getServerSession(authOptions)
+ if (!session?.user?.id) {
+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
+ }
+
+ const { searchParams } = new URL(request.url)
+ const contractId = searchParams.get('contractId')
+ const sourceSystem = searchParams.get('sourceSystem') || 'DOLCE'
+
+ if (!contractId) {
+ return NextResponse.json(
+ { error: 'Contract ID is required' },
+ { status: 400 }
+ )
+ }
+
+ const status = await importService.getImportStatus(
+ Number(contractId),
+ sourceSystem
+ )
+
+ return NextResponse.json(status)
+ } catch (error) {
+ console.error('Failed to get import status:', error)
+ return NextResponse.json(
+ {
+ error: 'Failed to get import status',
+ message: error instanceof Error ? error.message : 'Unknown error'
+ },
+ { status: 500 }
+ )
+ }
+} \ No newline at end of file