- 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
23 lines
811 B
TypeScript
23 lines
811 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getMorningSummaryService } from '@/lib/services/morning-summary-service';
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const body = await request.json().catch(() => ({}));
|
|
const webhookIds: number[] | undefined = body.webhookIds;
|
|
|
|
const service = getMorningSummaryService();
|
|
const { summary, results } = await service.run(webhookIds);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
openCount: summary.openCount,
|
|
resolvedCount: summary.resolvedCount,
|
|
isWeekendWindow: summary.isWeekendWindow,
|
|
results,
|
|
});
|
|
} catch (error) {
|
|
console.error('[POST /api/notifications/morning-summary/send]', error);
|
|
return NextResponse.json({ error: String(error) }, { status: 500 });
|
|
}
|
|
}
|