real-time notifications and alerts system
This commit is contained in:
27
pages/api/notifications/alerts.ts
Normal file
27
pages/api/notifications/alerts.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next"
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (req.method === "GET") {
|
||||
// Get recent alerts
|
||||
res.json({
|
||||
alerts: [
|
||||
{
|
||||
id: 1,
|
||||
type: 'high_risk_report',
|
||||
message: 'New high-risk report requires attention',
|
||||
created_at: new Date().toISOString(),
|
||||
read: false
|
||||
}
|
||||
]
|
||||
})
|
||||
} else if (req.method === "POST") {
|
||||
// Create new alert
|
||||
const { type, message, user_id } = req.body
|
||||
res.json({
|
||||
success: true,
|
||||
alert_id: Date.now()
|
||||
})
|
||||
} else {
|
||||
res.status(405).json({ error: "Method not allowed" })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user