summaryrefslogtreecommitdiff
path: root/app/api/sync/import/status
diff options
context:
space:
mode:
Diffstat (limited to 'app/api/sync/import/status')
-rw-r--r--app/api/sync/import/status/route.ts26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/api/sync/import/status/route.ts b/app/api/sync/import/status/route.ts
index ddb202e4..ddebcd19 100644
--- a/app/api/sync/import/status/route.ts
+++ b/app/api/sync/import/status/route.ts
@@ -3,11 +3,13 @@ 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"
+import { debugProcess, debugError, debugSuccess } from "@/lib/debug-utils"
export async function GET(request: NextRequest) {
try {
const session = await getServerSession(authOptions)
if (!session?.user?.id) {
+ debugError(`인증 실패`, { userId: session?.user?.id })
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}
@@ -16,20 +18,40 @@ export async function GET(request: NextRequest) {
const sourceSystem = searchParams.get('sourceSystem') || 'DOLCE'
if (!projectId) {
+ debugError(`필수 파라미터 누락`, { projectId, sourceSystem })
return NextResponse.json(
- { error: 'Contract ID is required' },
+ { error: 'Project ID is required' },
{ status: 400 }
)
}
+ debugProcess(`DOLCE 상태 조회 API 호출`, {
+ projectId,
+ sourceSystem,
+ userId: session.user.id
+ })
+
const status = await importService.getImportStatus(
Number(projectId),
sourceSystem
)
+ debugSuccess(`DOLCE 상태 조회 완료`, {
+ projectId,
+ availableDocuments: status.availableDocuments,
+ newDocuments: status.newDocuments,
+ updatedDocuments: status.updatedDocuments,
+ availableAttachments: status.availableAttachments,
+ newAttachments: status.newAttachments,
+ importEnabled: status.importEnabled
+ })
+
return NextResponse.json(status)
} catch (error) {
- console.error('Failed to get import status:', error)
+ debugError(`DOLCE 상태 조회 실패`, {
+ projectId: request.nextUrl.searchParams.get('projectId'),
+ error
+ })
return NextResponse.json(
{
error: 'Failed to get import status',