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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user