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
+11 -1
View File
@@ -28,10 +28,20 @@ export async function POST(
if (body.verdict !== 'verified' && body.verdict !== 'reopened')
return NextResponse.json({ error: 'verdict must be verified or reopened' }, { status: 422 })
const verifiedAt = new Date()
const recheckDate = new Date(verifiedAt)
recheckDate.setDate(recheckDate.getDate() + 30)
const update: Record<string, unknown> = {
status: body.verdict,
verified_by: user.id,
verified_at: new Date().toISOString(),
verified_at: verifiedAt.toISOString(),
...(body.verdict === 'verified'
? {
effectiveness_recheck_date: recheckDate.toISOString().split('T')[0],
effectiveness_recheck_round: 0,
}
: {}),
}
const { error } = await supabase