diff --git a/services/notification_error.service.js b/services/notification_error.service.js index eb6215a..f81e596 100644 --- a/services/notification_error.service.js +++ b/services/notification_error.service.js @@ -32,6 +32,7 @@ const { const { ErrorHandler } = require("../helpers/error"); const { deleteReminder } = require("./notifikasi-wa.service"); +const { getSparepartsByYearlyDb } = require("../db/sparepart.db"); class NotificationService { static async getAllNotification(param) { @@ -135,6 +136,16 @@ class NotificationService { notification.activity_logs = notificationLogs; + notification.is_reminder = false; + notification.spareparts_reminder = []; + if (notification.message_error_issue) { + const sparepartsReminder = await getSparepartsByYearlyDb(notification.error_code_id); + + notification.spareparts_reminder = sparepartsReminder ?? []; + notification.is_reminder = true; + + } + return notification; } catch (error) { throw new ErrorHandler(error.statusCode, error.message);