summaryrefslogtreecommitdiff
path: root/app/api/sync
diff options
context:
space:
mode:
Diffstat (limited to 'app/api/sync')
-rw-r--r--app/api/sync/batches/route.ts6
-rw-r--r--app/api/sync/config/route.ts12
-rw-r--r--app/api/sync/import/route.ts6
-rw-r--r--app/api/sync/import/status/route.ts6
-rw-r--r--app/api/sync/status/route.ts18
-rw-r--r--app/api/sync/trigger/route.ts6
-rw-r--r--app/api/sync/workflow/action/route.ts6
-rw-r--r--app/api/sync/workflow/status/route.ts6
8 files changed, 33 insertions, 33 deletions
diff --git a/app/api/sync/batches/route.ts b/app/api/sync/batches/route.ts
index a1ef8d26..7a72530d 100644
--- a/app/api/sync/batches/route.ts
+++ b/app/api/sync/batches/route.ts
@@ -4,11 +4,11 @@ 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 projectId = searchParams.get('projectId')
const targetSystem = searchParams.get('targetSystem') || 'SHI'
const limit = parseInt(searchParams.get('limit') || '10')
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -16,7 +16,7 @@ export async function GET(request: NextRequest) {
}
const batches = await syncService.getRecentSyncBatches(
- parseInt(contractId),
+ parseInt(projectId),
targetSystem,
limit
)
diff --git a/app/api/sync/config/route.ts b/app/api/sync/config/route.ts
index e54762fc..db5d17ca 100644
--- a/app/api/sync/config/route.ts
+++ b/app/api/sync/config/route.ts
@@ -6,10 +6,10 @@ import { authOptions } from "@/app/api/auth/[...nextauth]/route"
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
- const contractId = searchParams.get('contractId')
+ const projectId = searchParams.get('projectId')
const targetSystem = searchParams.get('targetSystem') || 'SHI'
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -17,7 +17,7 @@ export async function GET(request: NextRequest) {
}
const config = await syncService.getSyncConfig(
- parseInt(contractId),
+ parseInt(projectId),
targetSystem
)
@@ -48,7 +48,7 @@ export async function POST(request: NextRequest) {
}
const body = await request.json()
const {
- contractId,
+ projectId,
targetSystem,
endpointUrl,
authToken,
@@ -57,7 +57,7 @@ export async function POST(request: NextRequest) {
maxBatchSize
} = body
- if (!contractId || !targetSystem || !endpointUrl) {
+ if (!projectId || !targetSystem || !endpointUrl) {
return NextResponse.json(
{ error: 'Contract ID, target system, and endpoint URL are required' },
{ status: 400 }
@@ -65,7 +65,7 @@ export async function POST(request: NextRequest) {
}
await syncService.upsertSyncConfig({
- contractId,
+ projectId,
targetSystem,
endpointUrl,
authToken,
diff --git a/app/api/sync/import/route.ts b/app/api/sync/import/route.ts
index a6496578..f32a99e2 100644
--- a/app/api/sync/import/route.ts
+++ b/app/api/sync/import/route.ts
@@ -11,9 +11,9 @@ export async function POST(request: NextRequest) {
}
const body = await request.json()
- const { contractId, sourceSystem = 'DOLCE' } = body
+ const { projectId, sourceSystem = 'DOLCE' } = body
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -21,7 +21,7 @@ export async function POST(request: NextRequest) {
}
const result = await importService.importFromExternalSystem(
- contractId,
+ projectId,
sourceSystem
)
diff --git a/app/api/sync/import/status/route.ts b/app/api/sync/import/status/route.ts
index c5b4b0bd..ddb202e4 100644
--- a/app/api/sync/import/status/route.ts
+++ b/app/api/sync/import/status/route.ts
@@ -12,10 +12,10 @@ export async function GET(request: NextRequest) {
}
const { searchParams } = new URL(request.url)
- const contractId = searchParams.get('contractId')
+ const projectId = searchParams.get('projectId')
const sourceSystem = searchParams.get('sourceSystem') || 'DOLCE'
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -23,7 +23,7 @@ export async function GET(request: NextRequest) {
}
const status = await importService.getImportStatus(
- Number(contractId),
+ Number(projectId),
sourceSystem
)
diff --git a/app/api/sync/status/route.ts b/app/api/sync/status/route.ts
index 886c14df..b4b18577 100644
--- a/app/api/sync/status/route.ts
+++ b/app/api/sync/status/route.ts
@@ -33,22 +33,22 @@ function serializeForJSON(obj: any): any {
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url)
- const contractId = searchParams.get('contractId')
+ const projectId = searchParams.get('projectId')
const targetSystem = searchParams.get('targetSystem') || 'SHI'
-
- if (!contractId) {
+
+ if (!projectId) {
return NextResponse.json(
- { error: 'Contract ID is required' },
+ { error: 'Project ID is required' },
{ status: 400 }
)
}
-
+
let status
try {
// 실제 데이터베이스에서 조회 시도
status = await syncService.getSyncStatus(
- parseInt(contractId),
+ parseInt(projectId),
targetSystem
)
} catch (error) {
@@ -56,7 +56,7 @@ export async function GET(request: NextRequest) {
// ✅ 데이터베이스 조회 실패시 임시 목업 데이터 반환
status = {
- contractId: parseInt(contractId),
+ projectId: parseInt(projectId),
targetSystem,
totalChanges: 15,
pendingChanges: 3, // 3건 대기 중 (빨간 뱃지 표시용)
@@ -67,10 +67,10 @@ export async function GET(request: NextRequest) {
syncEnabled: true
}
}
-
+
// JSON 직렬화 가능한 형태로 변환
const serializedStatus = serializeForJSON(status)
-
+
return NextResponse.json(serializedStatus)
} catch (error) {
console.error('Failed to get sync status:', error)
diff --git a/app/api/sync/trigger/route.ts b/app/api/sync/trigger/route.ts
index 3393365d..3fe58849 100644
--- a/app/api/sync/trigger/route.ts
+++ b/app/api/sync/trigger/route.ts
@@ -13,9 +13,9 @@ export async function POST(request: NextRequest) {
}
const body = await request.json()
- const { contractId, targetSystem = 'SHI' } = body
+ const { projectId, targetSystem = 'SHI' } = body
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -23,7 +23,7 @@ export async function POST(request: NextRequest) {
}
const result = await syncService.syncToExternalSystem(
- contractId,
+ projectId,
targetSystem,
true // manual trigger
)
diff --git a/app/api/sync/workflow/action/route.ts b/app/api/sync/workflow/action/route.ts
index b6b1a94f..8e311c86 100644
--- a/app/api/sync/workflow/action/route.ts
+++ b/app/api/sync/workflow/action/route.ts
@@ -12,9 +12,9 @@ export async function POST(request: NextRequest) {
}
const body = await request.json()
- const { contractId, targetSystem = 'SWP', action, documents } = body
+ const { projectId, targetSystem = 'SWP', action, documents } = body
- if (!contractId || !action) {
+ if (!projectId || !action) {
return NextResponse.json(
{ error: 'Contract ID and action are required' },
{ status: 400 }
@@ -22,7 +22,7 @@ export async function POST(request: NextRequest) {
}
const result = await workflowService.executeWorkflowAction(
- contractId,
+ projectId,
targetSystem,
action,
documents || [],
diff --git a/app/api/sync/workflow/status/route.ts b/app/api/sync/workflow/status/route.ts
index a4c5d1d0..1274f049 100644
--- a/app/api/sync/workflow/status/route.ts
+++ b/app/api/sync/workflow/status/route.ts
@@ -12,10 +12,10 @@ export async function GET(request: NextRequest) {
}
const { searchParams } = new URL(request.url)
- const contractId = searchParams.get('contractId')
+ const projectId = searchParams.get('projectId')
const targetSystem = searchParams.get('targetSystem') || 'SWP'
- if (!contractId) {
+ if (!projectId) {
return NextResponse.json(
{ error: 'Contract ID is required' },
{ status: 400 }
@@ -23,7 +23,7 @@ export async function GET(request: NextRequest) {
}
const status = await workflowService.getWorkflowStatus(
- Number(contractId),
+ Number(projectId),
targetSystem
)