import { fetchAlerts, createAlert, removeAlert, fetchNotifications, updateNotifications, updateNotification, } from '../alerts.js'; export async function fetchAlertsApi(req, res) { const alerts = await fetchAlerts(req.user); res.send(alerts); } export async function createAlertApi(req, res) { const alertId = await createAlert(req.body, req.user); res.send({ id: alertId }); } export async function removeAlertApi(req, res) { await removeAlert(req.params.alertId, req.user); res.status(204).send(); } export async function fetchNotificationsApi(req, res) { const notifications = await fetchNotifications(req.user, { limit: req.query.limit || 10, }); res.send(notifications); } export async function updateNotificationsApi(req, res) { await updateNotifications(req.body, req.user); res.status(204).send(); } export async function updateNotificationApi(req, res) { await updateNotification(req.params.notificationId, req.body, req.user); res.status(204).send(); }