feat: email notifications via Resend on new incident
This commit is contained in:
@@ -2,6 +2,7 @@ import { NextResponse } from 'next/server'
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { validateIncidentInput } from '@/lib/incidents/validate'
|
||||
import { uploadEvidenceFile, type EvidenceStage } from '@/lib/supabase/storage'
|
||||
import { sendNewIncidentEmail } from '@/lib/notifications/email'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
@@ -105,5 +106,8 @@ export async function POST(request: Request) {
|
||||
p_new_value: { incident_type: input.incident_type, reported_by: user.id },
|
||||
})
|
||||
|
||||
sendNewIncidentEmail(incident.id, zone.site_id, incident.reference_no ?? '', input.incident_type)
|
||||
.catch(err => console.error('email notification failed:', err))
|
||||
|
||||
return NextResponse.json({ id: incident.id, reference_no: incident.reference_no }, { status: 201 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user