feat: CAPA effectiveness re-check cron — 30/60/90-day email + WhatsApp notifications

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
This commit is contained in:
2026-07-11 18:55:27 +08:00
co-authored by Claude Sonnet 4.6
parent 76d9363c3c
commit b9def9c957
4 changed files with 202 additions and 1 deletions
@@ -0,0 +1,17 @@
export const dynamic = 'force-dynamic'
import { NextRequest, NextResponse } from 'next/server'
import { createClient } from '@/lib/supabase/server'
import { sendEffectivenessRecheckNotifications } from '@/lib/notifications/effectiveness-recheck'
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 sendEffectivenessRecheckNotifications(supabase)
return NextResponse.json({ ok: true, notified })
}