summaryrefslogtreecommitdiff
path: root/lib/vendor-document-list/sync-client.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-28 00:32:31 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-28 00:32:31 +0000
commit20800b214145ee6056f94ca18fa1054f145eb977 (patch)
treeb5c8b27febe5b126e6d9ece115ea05eace33a020 /lib/vendor-document-list/sync-client.ts
parente1344a5da1aeef8fbf0f33e1dfd553078c064ccc (diff)
(대표님) lib 파트 커밋
Diffstat (limited to 'lib/vendor-document-list/sync-client.ts')
-rw-r--r--lib/vendor-document-list/sync-client.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/vendor-document-list/sync-client.ts b/lib/vendor-document-list/sync-client.ts
new file mode 100644
index 00000000..11439dcb
--- /dev/null
+++ b/lib/vendor-document-list/sync-client.ts
@@ -0,0 +1,28 @@
+export class SyncClient {
+ static async getSyncStatus(contractId: number, targetSystem: string = 'SHI') {
+ const response = await fetch(`/api/sync/status?contractId=${contractId}&targetSystem=${targetSystem}`)
+ if (!response.ok) throw new Error('Failed to fetch sync status')
+ return response.json()
+ }
+
+ static async triggerSync(contractId: number, targetSystem: string = 'SHI') {
+ const response = await fetch('/api/sync/trigger', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ contractId, targetSystem })
+ })
+
+ if (!response.ok) {
+ const error = await response.json()
+ throw new Error(error.message || 'Sync failed')
+ }
+
+ return response.json()
+ }
+
+ static async getSyncBatches(contractId: number, targetSystem: string = 'SHI', limit: number = 10) {
+ const response = await fetch(`/api/sync/batches?contractId=${contractId}&targetSystem=${targetSystem}&limit=${limit}`)
+ if (!response.ok) throw new Error('Failed to fetch sync batches')
+ return response.json()
+ }
+ } \ No newline at end of file