- Add admin dashboard with sync controls and data browser - Implement RMM, Auvik, and Addigy organization mappings - Add chunked ticket sync with progress tracking - Implement entity sync service with rate limiting - Add analytics engine and performance optimizer - Create data browser for all PSA entities - Add navigation components and UI improvements - Implement background processing and sync services - Add comprehensive documentation and migration scripts - Update configuration items with multi-system support - Enhance contact management and purchase history - Add issue type assignment and LLM analyzer - Improve error handling and logging utilities
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { syncProgressTracker } from '@/lib/services/sync-progress-tracker';
|
|
|
|
/**
|
|
* GET /api/sync/progress
|
|
* Get sync progress for a specific sync or entity type
|
|
*/
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const searchParams = request.nextUrl.searchParams;
|
|
const syncId = searchParams.get('syncId');
|
|
const entityType = searchParams.get('entityType');
|
|
|
|
if (syncId) {
|
|
// Get specific sync progress
|
|
const progress = syncProgressTracker.getProgress(syncId);
|
|
if (!progress) {
|
|
return NextResponse.json(
|
|
{ error: 'Sync not found' },
|
|
{ status: 404 }
|
|
);
|
|
}
|
|
return NextResponse.json({ progress });
|
|
}
|
|
|
|
if (entityType) {
|
|
// Get latest sync for entity type
|
|
const progress = syncProgressTracker.getLatestSync(entityType);
|
|
if (!progress) {
|
|
return NextResponse.json(
|
|
{ error: 'No sync found for entity type' },
|
|
{ status: 404 }
|
|
);
|
|
}
|
|
return NextResponse.json({ progress });
|
|
}
|
|
|
|
// Get all active syncs
|
|
const activeSyncs = syncProgressTracker.getActiveSyncs();
|
|
return NextResponse.json({ activeSyncs });
|
|
|
|
} catch (error) {
|
|
console.error('Error fetching sync progress:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch sync progress' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|