summaryrefslogtreecommitdiff
path: root/app/api/cron/object-classes/route.ts
blob: 9a574b1b35995cde742af8afa53db4d5436c4e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// src/app/api/cron/object-classes/route.ts
import { syncObjectClasses } from '@/lib/sedp/sync-object-class';
import { NextRequest } from 'next/server';

export async function GET(request: NextRequest) {
  try {
    console.log('오브젝트 클래스 동기화 API 호출됨:', new Date().toISOString());
    
    // syncObjectClasses 함수 호출
    const result = await syncObjectClasses();
    
    // 성공 시 결과와 함께 200 OK 반환
    return Response.json({ success: true, result }, { status: 200 });
  } catch (error: any) {
    console.error('오브젝트 클래스 동기화 API 에러:', error);
    
    // 에러 시에는 message를 담아 500 반환
    const message = error.message || 'Something went wrong';
    return Response.json({ success: false, error: message }, { status: 500 });
  }
}