From 3b26e06ffe648b6d4da5ed68feafaa1953238576 Mon Sep 17 00:00:00 2001 From: Fachba Date: Wed, 29 Apr 2026 17:23:08 +0700 Subject: [PATCH] feat: integrate spareparts reminder functionality into notification service --- services/notification_error.service.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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);