wisdom #18

Merged
bragaz_rexita merged 11 commits from wisdom into main 2025-11-28 05:09:59 +00:00
4 changed files with 31 additions and 2 deletions
Showing only changes of commit 380864b1ab - Show all commits

View File

@@ -31,6 +31,21 @@ class NotificationErrorLogController {
}
}
// Get notification error logs by notification_error_id
static async getByNotificationErrorId(req, res) {
try {
const { id } = req.params;
const results = await NotificationErrorLogService.getNotificationErrorLogByNotificationErrorId(id);
const response = await setResponse(results, 'Notification Error Logs found')
res.status(response.statusCode).json(response);
} catch (error) {
const response = await setResponse(error, error.message, error.statusCode || 500);
res.status(response.statusCode).json(response);
}
}
// Create notification error log
static async create(req, res) {
try {

View File

@@ -12,4 +12,7 @@ router.route("/")
router.route("/:id")
.get(verifyToken.verifyAccessToken, NotificationErrorLogController.getById);
router.route("/notification_error/:id")
.get(verifyToken.verifyAccessToken, NotificationErrorLogController.getByNotificationErrorId);
module.exports = router;

View File

@@ -14,6 +14,7 @@ const {
const {
getAllNotificationErrorLogDb,
getNotificationErrorLogByNotificationErrorIdDb,
} = require('../db/notification_error_log.db');
const { getFileUploadByPathDb } = require('../db/file_uploads.db');
@@ -78,8 +79,7 @@ class NotificationService {
}
// Get activity logs for this notification
const activityLogs = (await getAllNotificationErrorLogDb()) || [];
const notificationLogs = activityLogs.filter(log => log.notification_error_id === parseInt(id));
const notificationLogs = (await getNotificationErrorLogByNotificationErrorIdDb(id)) || [];
notification.activity_logs = notificationLogs;

View File

@@ -59,6 +59,17 @@ class NotificationErrorLogService {
}
}
// Get Notification Error Log by notification_error_id
static async getNotificationErrorLogByNotificationErrorId(notificationErrorId) {
try {
const results = await getNotificationErrorLogByNotificationErrorIdDb(notificationErrorId);
return results;
} catch (error) {
throw new ErrorHandler(error.statusCode, error.message);
}
}
// Soft delete Notification Error Log
static async deleteNotificationErrorLog(id, userId) {
try {