feat: CAPA overdue escalation cron — 4 thresholds, once-per-threshold via notifications_log
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { escalateOverdueCapa } from '@/lib/notifications/capa-escalation'
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const auth = request.headers.get('authorization')
|
||||
const expected = `Bearer ${process.env.CRON_SECRET}`
|
||||
if (!auth || auth !== expected) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
const supabase = await createClient()
|
||||
const { notified } = await escalateOverdueCapa(supabase)
|
||||
return NextResponse.json({ ok: true, notified })
|
||||
}
|
||||
Reference in New Issue
Block a user