Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
18 lines
647 B
TypeScript
18 lines
647 B
TypeScript
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 })
|
|
}
|