- Add MorningSummaryService with Zabbix aggregation and adaptive card builder - Add webhook delivery system with Teams incoming webhooks - Add admin UI at /admin/morning-summary for webhook/config management - Add API routes: /send, /test, /webhooks, /webhooks/[id], /config, /history - Register morning-summary cron job in SyncScheduler (Mon-Fri 6:30 AM) - Add outages_only filter (Unavailable triggers only) - Fix host resolution: use getTriggerEnabledHosts to exclude disabled hosts - Fix resolved events: event.get value:1 scoped to window with r_eventid filter - Remove emojis from fact rows and section headers in card - Remove Open Zabbix button (duplicate of View Problems) - Add migrations: morning_summary_config + morning_summaries tables - Add outages_only column to morning_summary_config
30 lines
969 B
TypeScript
30 lines
969 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getEngagementSyncService } from '@/lib/services/engagement-sync-service';
|
|
import { isMsgraphConfigured } from '@/lib/services/msgraph-factory';
|
|
|
|
export async function POST() {
|
|
if (!isMsgraphConfigured()) {
|
|
return NextResponse.json(
|
|
{ error: 'Microsoft Graph not configured. Set MSGRAPH_CLIENT_ID, MSGRAPH_CLIENT_SECRET, MSGRAPH_TENANT_ID.' },
|
|
{ status: 503 }
|
|
);
|
|
}
|
|
|
|
const service = getEngagementSyncService();
|
|
|
|
if (service.isSyncInProgress()) {
|
|
return NextResponse.json({ error: 'Sync already in progress' }, { status: 409 });
|
|
}
|
|
|
|
// Fire and forget
|
|
service.sync().catch(err => {
|
|
console.error('[ENGAGEMENT-SYNC-API] Background sync failed:', err);
|
|
});
|
|
|
|
return NextResponse.json({ message: 'Engagement sync started' });
|
|
}
|
|
|
|
export async function GET() {
|
|
const service = getEngagementSyncService();
|
|
return NextResponse.json({ isSyncing: service.isSyncInProgress() });
|
|
}
|