/** * Copyright (c) 2026 Niolla * All rights reserved. * * This source code is proprietary and confidential. * Unauthorized copying, modification, distribution, or use * of this file, via any medium, is strictly prohibited. */ // app/routes/notification.routes.js const express = require("express"); const router = express.Router(); const notificationController = require("../controllers/notification.controller"); const { authenticate, } = require("../middleware/auth.middleware"); const { authorizedAccountType, checkPermission, } = require("../middleware/permission.middleware"); const PERMISSIONS = require("../constants/permissions"); // Create notification router.post( "/", authenticate, authorizedAccountType(["admin", "management"]), // checkPermission(PERMISSIONS.NOTIFICATION_CREATE), notificationController.createNotification, ); // Get all announcements router.get( "/announcements", authenticate, authorizedAccountType(["admin", "management", "team_head", "user"]), // checkPermission(PERMISSIONS.NOTIFICATION_VIEW), notificationController.getAnnouncements, ); // Get notifications for a user router.get( "/user/:userId", authenticate, authorizedAccountType(["admin", "management", "team_head", "user"]), // checkPermission(PERMISSIONS.NOTIFICATION_VIEW), notificationController.getUserNotifications, ); // Mark notification as read router.patch( "/user/:userId/notification/:notificationId/read", authenticate, authorizedAccountType(["admin", "management", "team_head", "user"]), // checkPermission(PERMISSIONS.NOTIFICATION_READ), notificationController.markAsRead, ); module.exports = router;