Merge branch 'feat/system-notices' into dev

This commit is contained in:
Julien G.
2026-04-16 14:38:14 +02:00
committed by GitHub
46 changed files with 3538 additions and 50 deletions
+29
View File
@@ -0,0 +1,29 @@
import { Router } from 'express';
import { authenticate } from '../middleware/auth.js';
import { getActiveNoticesFor, dismissNotice } from '../systemNotices/service.js';
import type { AuthRequest } from '../types.js';
const router = Router();
// GET /api/system-notices/active
// Returns notices active for the authenticated user.
router.get('/active', authenticate, (req, res) => {
const userId = (req as AuthRequest).user!.id;
const notices = getActiveNoticesFor(userId);
res.json(notices);
});
// POST /api/system-notices/:id/dismiss
// Marks a notice as dismissed for the authenticated user. Idempotent.
router.post('/:id/dismiss', authenticate, (req, res) => {
const userId = (req as AuthRequest).user!.id;
const noticeId = req.params.id;
const ok = dismissNotice(userId, noticeId);
if (!ok) {
res.status(404).json({ error: 'NOTICE_NOT_FOUND' });
return;
}
res.status(204).end();
});
export default router;