feat(admin): add restore dismissed alerts flow
Admins can now surface dismissed alert types without waiting for the underlying data to change. Adds a collapsible "Restore dismissed" section below the active alerts with per-type checkboxes. - ALERT_METADATA map in adminAlerts.js as the single source of truth for slug → title/severity; detectors refactored to reference it - GET /api/admin/alerts/dismissed returns this admin's dismissals joined with metadata (title, severity, dismissedAt) - POST /api/admin/alerts/restore deletes dismissals by alertType[], returns the deleted count - AdminAlertsPanel fetches both active + dismissed; stays visible when either is non-empty; checkboxes + "Restore selected" button - adminAlertRestoreSchema validates the POST body against the enum - Auth guards test covers both new routes
This commit is contained in:
parent
a2af4e31ff
commit
92e7dae74c
7 changed files with 423 additions and 41 deletions
|
|
@ -42,7 +42,9 @@ const adminRoutes = {
|
|||
],
|
||||
'admin/alerts/': [
|
||||
'alerts/index.get.js',
|
||||
'alerts/dismiss.post.js'
|
||||
'alerts/dismiss.post.js',
|
||||
'alerts/dismissed.get.js',
|
||||
'alerts/restore.post.js'
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +70,9 @@ const businessLogicPatterns = [
|
|||
'PreRegistration.aggregate',
|
||||
'PreRegistration.updateMany',
|
||||
'computeAllAlerts(',
|
||||
'AdminAlertDismissal.findOneAndUpdate'
|
||||
'AdminAlertDismissal.findOneAndUpdate',
|
||||
'AdminAlertDismissal.find',
|
||||
'AdminAlertDismissal.deleteMany'
|
||||
]
|
||||
|
||||
describe('Admin endpoint auth guards', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue