27 lines
704 B
TypeScript
27 lines
704 B
TypeScript
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" })
|
|
}
|
|
} |