blob: ed9d30ce3202a1894626cf3b2f2afcd04a9fe5c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// app/api/stage-submissions/sync/route.ts
import { ShiBuyerSystemAPI } from "@/lib/vendor-document-list/plant/shi-buyer-system-api"
import { NextRequest, NextResponse } from "next/server"
export async function POST(req: NextRequest) {
try {
const body = await req.json()
const { submissionIds } = body
if (!submissionIds || !Array.isArray(submissionIds) || submissionIds.length === 0) {
return NextResponse.json(
{ error: "제출 ID 목록이 필요합니다." },
{ status: 400 }
)
}
const api = new ShiBuyerSystemAPI()
const results = await api.syncSubmissionsToSHI(submissionIds)
return NextResponse.json({
success: true,
message: `${results.successCount}/${results.totalCount}개 제출 건이 동기화되었습니다.`,
results
})
} catch (error) {
console.error("Sync API Error:", error)
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : "동기화 실패"
},
{ status: 500 }
)
}
}
|