The frontend test notification feature was calling /api/test-notifications/trigger, but this endpoint didn't exist in the backend, causing a 404 HTML response that failed JSON parsing with the error "JSON.parse: unexpected character at line 1 column 1". Changes: - Added triggerTestNotification service method to handle test notification creation - Added triggerTestNotification controller method to handle the API request - Registered POST /test-notifications/trigger route - Implemented type mapping for all notification types (task_due_soon, task_overdue, defer_until, project_due_soon, project_overdue) - Test notifications respect user notification preferences and send to enabled channels - Returns notification details with sources (in-app, telegram) sent to Fixes #1002
24 lines
746 B
JavaScript
24 lines
746 B
JavaScript
'use strict';
|
|
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const notificationsController = require('./controller');
|
|
|
|
router.get('/notifications', notificationsController.getAll);
|
|
router.get(
|
|
'/notifications/unread-count',
|
|
notificationsController.getUnreadCount
|
|
);
|
|
router.post('/notifications/:id/read', notificationsController.markAsRead);
|
|
router.post('/notifications/:id/unread', notificationsController.markAsUnread);
|
|
router.post(
|
|
'/notifications/mark-all-read',
|
|
notificationsController.markAllAsRead
|
|
);
|
|
router.delete('/notifications/:id', notificationsController.dismiss);
|
|
router.post(
|
|
'/test-notifications/trigger',
|
|
notificationsController.triggerTestNotification
|
|
);
|
|
|
|
module.exports = router;
|